Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a server monitoring script which, among other things, checks the state of an IPSec tunnel using

ipsec auto --status

It works like a charm when run from the console (as root) but as soon as I run it from a (root) cronjob, the command fails: no output at all.

I even tried to create this simple root cronjob:

*/1 * * * * ipsec auto --status > /tmp/ipsec.txt

All it does is create an empty /tmp/ipsec.txt file!

Note: All other tasks in the script including networking and DB access work fine.

Any lights welcome.

share|improve this question
up vote 2 down vote accepted

It sounds like cron is not seeing ipsec in the path. It's a pretty good habit to include absolute paths to binaries in crontab. There is probably some complaining in /var/log/messages or /var/log/cron.

*/1 * * * * /usr/sbin/ipsec auto --status

You could also add the PATH environment variable to the top of the crontab. The PATH will apply to all the jobs in the crontab.

*/1 * * * * /usr/sbin/ipsec auto --status
share|improve this answer
ha! What a dork! errr... me. not you :-) – Serge Wautier May 9 '12 at 19:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.