So I have a script called rotate.sh which runs in crontab everday at 11:50pm
The script basically tries to rotate two files .. sync.log and grp.log .. these files might still be written on so its kind of a live rotate..
It is a SunOS Sparc system -- Old one 5.8
The goal is to rotate sync.log and gzip -9 to YYYY_MM_DD_FILENAME.gz and same for grp.log and save both the files in the same directory . Also then leave the same filenames there even if empty so that applications can carry on writing to them
The script I wrote which is obviously wrong is (also resides in another directory)
cat $GRPLOGFILE | gzip -9 > $GRPLOGOUTPUT && > $GRPLOGFILE
cat $SYNLOGFILE | gzip -9 > $SYNLOGOUTPUT && > $SYNLOGFILE
1) Filename was screwed up .. was missing FILENAME
2) Saved it in the user who was running the crontab home directory instead of the logfile directory (/net/logs)
3) Might be other issues which I couldn't see
4) I think the grp rotate didn't work
Can someone please clean up the code and tell me what is the best way to do this..