All,
I have a requirement that if the hostname of the server starts with tm1 or dm1 then it should create gz1 format of log files , if the hostname starts with pc1 then it should create bz1 format of logs.
I have created a generic shell script to create tar files of log files :
#!/bin/bash
#START
TIME=$(date +%Y%-m%-d)
FILENAME=logsbackup-$TIME.tar.gz
SRCDIR=/var/log/
DESDIR=/var/
find $SRCDIR -mtime +1 | xargs tar -cpzf $DESDIR/$FILENAME
#END
How can I implement the above mentioned changes in my script.