Cron tips - No mail log
I use the following cron job to keep tracking the IP of my mac:
*/20 * * * * curl http://jack.asprise.net/private.php?update=1
The job will be executed every 20 minutes. It will 'visit' a web page, and the web page will detect and store the ip:
HTTP_X_FORWARDED_FOR: 219.74.x.x
HTTP_CLIENT_IP:
REMOTE_ADDR: 165.21.x.x
(January 29, 2007, 9:40 am)
The annoying part is that I receive a lot of mail, and it turns out that mailing can be disabled by appending > /dev/null:
*/20 * * * * curl http://jack.asprise.net/private.php?update=1 > /dev/null
According to this article, "Normally, the output generated by every command in the system crontab is automatically mailed to the system administrator (or, in the case of a user crontab, to the user who owns it). If you have a lot of crontab entries, this is a quick way of getting snowed under with e-mail. To avoid this, you can redirect the output of the command/script in the crontab to the system bitbucket /dev/null with the redirection operator".

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home