Set up cronjob to periodically check for inbound issue emails
20 Oct 2005
Perhaps you're using the POP3 support in your issuetracker instance but feel uncertain about how to set up the crobjob. This howto shows you how to set up a crontab on Linux.
First of all you need to have root access on the Linux system you intend to set this up. If you open the POP3 of the issue tracker instance you have, you'll find a URL there that you need to visit to trigger the email checking. That URL takes care of everything, all you have to do is make sure it gets visited in one form or another.
First of all, create a Python script that will open this URL. Create a script called TriggerIssuetrackerEmailCheck.py in /usr/sbin/ like this:
# emacs /usr/sbin/TriggerIssuetrackerEmailCheck.py
(you can of course save it in another folder if you like as long as you remember where you saved it). Then enter this code and change the URL reference to that of your issuetracker:
#!/usr/bin/env python
import urllib import urlopen
print urlopen('http://some.com/issuetracker/check4MailIssues').read()
If your have more issuetracker, just enter several lines of that urlopen() stuff.
The next thing to do is to stick this in your crontab. If you're familar with vi, then use:
# crontab -e
If you're not, the simplest alternative is to open /etc/crontab and edit it that way:
# emacs /etc/crontab
The line you need to enter looks like this:
/10 * * * * root /usr/bin/python /usr/sbin/TriggerIssuetrackerEmailCheck.py
That means "run every 10 minutes as root". If you need more help on how to set up cron, you can read this howto for BSD or just ask your nearest sys admin guy.