Setting up cron as root
It's been awhile since I had to do this, so I hope you guys don't mind holding my hand :-)
I have a weird log file in the /tmp directory, named Net.WhoisIP.log. I gather that it's related to the Net::Whois Perl module that I use, but I can't find a way to turn off the log! When I looked earlier today, the log file was around 2G.
I don't know if deleting it will impact the module, so I figured I would just empty it through a cron every month.
IIRC, this needs to be done by manually editing /etc/crontab.
Assuming that's correct, does this look right?
I'm trying to make it run at 1:59am on the 31st of the month, which presumably means it would run every other month. Note that there's a single whitespace separating everything, including the "> /tmp/..." command. Is that correct? I ask because it looks weird, like the last space would be a confusing delimiter, which makes me worry that I'll accidentally truncate every file in /root/! LOL TIA!
59 1 31 * * root > /tmp/Net.WhoisIP.log
I'm trying to make it run at 1:59am on the 31st of the month, which presumably means it would run every other month. Note that there's a single whitespace separating everything, including the "> /tmp/..." command. Is that correct? I ask because it looks weird, like the last space would be a confusing delimiter, which makes me worry that I'll accidentally truncate every file in /root/! LOL TIA!
-
Hello :) Yes, You have setup correct cron. 59 1 31 * * root > /tmp/Net.WhoisIP.log
If you this cron on your server then it will be run at : 2016-01-31 01:59:00 2016-03-31 01:59:00 2016-05-31 01:59:00 2016-07-31 01:59:00 2016-08-31 01:59:00 ....0 -
Hello :) You may want to configure a script that completes the removal so that you configure the cron job like this: 59 1 31 * * /path/to/removal-script.sh
Thank you.0
Please sign in to leave a comment.
Comments
2 comments