multiple logs + incrementation (linux)

Need help? Post your questions here.

Moderator: moderators

multiple logs + incrementation (linux)

Postby twent4 » Sat Jul 25, 2009 4:45 am

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
twent4
 
Posts: 17
Joined: Tue Jul 07, 2009 1:06 am

Postby jigsaw » Tue Jul 28, 2009 9:55 pm

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?
Currently without Subsonic due to hardware failure :(
User avatar
jigsaw
 
Posts: 242
Joined: Sat Oct 13, 2007 12:01 pm
Location: Stavanger, Norway

Postby twent4 » Wed Jul 29, 2009 2:15 am

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?
twent4
 
Posts: 17
Joined: Tue Jul 07, 2009 1:06 am

Postby twent4 » Thu Jul 30, 2009 11:49 pm

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
twent4
 
Posts: 17
Joined: Tue Jul 07, 2009 1:06 am


Return to Help

Who is online

Users browsing this forum: No registered users and 26 guests