| View previous topic :: View next topic |
| Author |
Message |
BBBS Guest
|
Posted: Sun Jan 06, 2002 9:56 pm Post subject: |
|
|
i've written the following (yes it's ugly, but shell scripts ain't my best trick) script, what it does is run on a cron at 1am to gzip and move the old log leaving the current ones obviously (keep logs is on) to another directory. My main question is, can this be done any neater as i think this is rather ugly, it must run on a cron job.
Cheers
#!/bin/sh
/bin/rm -f /home/bot/temp.lst
/bin/rm -f /home/bot/temp2.lst
/bin/rm -f /home/bot/temp3.lst
/bin/ls -1t /home/bot/logs >/home/bot/temp.lst
/bin/fgrep -v gz /home/bot/temp.lst >/home/bot/temp2.lst
/usr/bin/tail --lines=+3 /home/bot/temp2.lst >/home/bot/temp3.lst
/bin/sed -e 's/^(.*)//bin/gzip /home/bot/logs/1/' /home/bot/temp3.lst |/bin/sh
/bin/mv -f /home/bot/logs/*.gz /home/logs/ |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|