Moderator
Staff member
Moderator
- Joined
- Aug 27, 2013
- Messages
- 800
- Reaction score
- 1,969
This is one of the things I keep forgetting doing: SAVE THE LOGS BEFORE WIPING THEM. So, I just though that it's not too hard to make linux do the job for me and save them into 1 directory, instead of me going and copying them. Yup, still being a newbie into all this, but with a little bit of help.
There you go, a tutorial on how to do it:
Firstly, create a folder cabal_history in root/var/log/ directory. (Should look like this: root/var/log/cabal_history)
P.S. Sometimes, permission 0755 might not work, so set it to 0700.
Second:
Open the cabal_restartlog.sh file (in root/home/cabal directory) and you will see this:
DEFAULT:
Add these 2 lines:
AFTER #!/bin/sh and BEFORE rm -f /var/log/cabal/*
Which will look like this:
Save it and you are done.
Now, each time you will write cabal_restartlog, your old logs will be saved inside new named folder (date+time) inside the cabal_history folder you've created in the root/var/log/ directory.
There you go, a tutorial on how to do it:
P.S.S. Another tutorial for not skilled people like me :junglejane:
##### Tutorial #####
Firstly, create a folder cabal_history in root/var/log/ directory. (Should look like this: root/var/log/cabal_history)
P.S. Sometimes, permission 0755 might not work, so set it to 0700.
Second:
Open the cabal_restartlog.sh file (in root/home/cabal directory) and you will see this:
DEFAULT:
Code:
[COLOR=#141414]#!/bin/sh[/COLOR]
[COLOR=#141414]
[/COLOR]
[COLOR=#141414]rm -f /var/log/cabal/*[/COLOR]
[COLOR=#141414]
[/COLOR]
[COLOR=#141414]countdown()[/COLOR]
[COLOR=#141414](*the rest of the script*[/COLOR]
Add these 2 lines:
Code:
[COLOR=#0000ff]mkdir /var/log/cabal_history/$(date '+%d-%b-%Y-%T')[/COLOR]
[COLOR=#0000ff]cp -r /var/log/cabal/*.log /var/log/cabal_history/$(date '+%d-%b-%Y-%T')[/COLOR]
AFTER #!/bin/sh and BEFORE rm -f /var/log/cabal/*
Which will look like this:
Code:
[COLOR=#141414]#!/bin/sh[/COLOR]
[COLOR=#141414]
[/COLOR]
[COLOR=#0000ff]mkdir /var/log/cabal_history/$(date '+%d-%b-%Y-%T')[/COLOR]
[COLOR=#0000ff]cp -r /var/log/cabal/*.log /var/log/cabal_history/$(date '+%d-%b-%Y-%T')[/COLOR]
[COLOR=#141414]rm -f /var/log/cabal/*[/COLOR]
[COLOR=#141414]
[/COLOR]
[COLOR=#141414]countdown()[/COLOR]
[COLOR=#141414](*the rest of the script*[/COLOR]
Save it and you are done.
Now, each time you will write cabal_restartlog, your old logs will be saved inside new named folder (date+time) inside the cabal_history folder you've created in the root/var/log/ directory.
credits to w3rnis