SRCDS Steam group


Cronjobs for Downloads/Log Folders?
#1
Hi Guys,

How can I create a cronjob set to run at oh, let's say about 3:00am every day to clean out the downloads and logs folder. Is this possible? I am not a linux guru so a little help would be great.

I know the command to remove all files from a specific folder:

rm -r *.*

So would the command look something like:

cd /home/path/to/logs/ && rm -r *.*

Just want to make sure I am doing this right. Also is it advised? I run fairly popular servers and those folders fill up quick.
Reply
#2
crontab -e
0 3 * * * cd /home/path/to/logs/ && rm -r * 2>&1 >/dev/null


Or make a script using vi like:
#!/bin/sh
# Comments
rm -r /home/path/to/logs/*

and other things you want to add

Close the file then:
chmod +x <filename>

Add that file to the crontab.
Reply
#3
In crontab -e

Paste this at the bottem
Code:
0 3 * * *  /home/cronlog.sh

"Ctrl + x" to leave nano

"y" to save changes to crontab,

"cd"

"cd /home/"

"nano cronlog.sh"

Paste this in:
Code:
cd
rm -f /home/<pathtologfolder/*>

"Ctrl + x" to leave nano

"y" to save changes to cronlog.sh

"chmod +x cronlog.sh" chmod the cronlog.sh file to be executeable

"/etc/init.d/cron restart" To restart the crontab.


I think Toungue

Good luck, Christy.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)