Page 1 of 1
multiple logs + incrementation (linux)

Posted:
Sat Jul 25, 2009 4:45 am
by twent4
Hey guys,
Does anyone have a way to modify subsonic.sh to check if subsonic_sh.log exists, rename the old one (date+time) and place it into a folder, then create a new one? I'm sure bash can do that, and i will get googling on this right away, just checking if anyone has done this already.
thanks

Posted:
Tue Jul 28, 2009 9:55 pm
by jigsaw
I wanted to prevent subsonic.sh to overwrite the subsonic_sh.log file every time it restarts, but I simply did that by modifying subsonic.sh to append to the existing log file ( using >> ) rather than overwriting with a new log file ( as it does with > ).
Is that your goal?

Posted:
Wed Jul 29, 2009 2:15 am
by twent4
That's actually a good idea, but i was hoping it would be more along the lines of:
if subsonic.log (i was wrong to say subsonic_sh.log, i just want the non-java runtime logs) exists.
move subsonic.log /var/subsonic/logs/subsonicXXXXXX.log
create subsonic.log
else
create subsonic.log
im just too stupid to put this into shell command context. i think ill do some googling when i get home from work...
EDIT(few hours later): So I'm back where i started, since subsonic_sh.log is created by subsonic.sh, but i need to auto-backup subsonic.log - created by java... grrr. any suggestions?

Posted:
Thu Jul 30, 2009 11:49 pm
by twent4
got it, easier than i thought
added
- Code: Select all
mv /var/subsonic/subsonic.log /var/subsonic/logs/"`date +%d%b%Y_%H%M`.log"
into rc.local before calling subsonic.sh