0

I set up a cron job with this test script:

#!/bin/sh
date >> /media/log/crontest.txt
ifconfig tun0 >>/media/log/crontest.txt

And in this crontad -e

 */1 * * * * /media/config/pia/tmp

But I don't get the output for ifconfig in the crontest.txt:

Thu May 29 11:39:01 EST 2014
Thu May 29 11:40:01 EST 2014
Thu May 29 11:43:01 EST 2014
Thu May 29 11:44:02 EST 2014
Thu May 29 11:45:01 EST 2014
Thu May 29 11:46:01 EST 2014
Thu May 29 11:47:01 EST 2014
4

cron scripts most likely lack PATH variable, therefore you have to specify the full path to your executables, that you could easily find using: which ifconfig and which date, and your script might look like this:

#!/bin/sh
/bin/date >> /media/log/crontest.txt
/sbin/ifconfig tun0 >>/media/log/crontest.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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