Crontab not succeed

HI,i am use openwrt/strongswan (pppoe) connect to company .(site to site)

I am make a task that let the strongswan start a connect 30 min/per .

~# ps | grep cron
 5103 root      1192 S    /usr/sbin/crond -f -c /etc/crontabs -l 8
24042 root      1188 S    grep cron

~# ipsec status
Security Associations (0 up, 0 connecting):
  none

~# crontab -l
*/30 * * * * /root/crontab.sh

~# cat crontab.sh
       ipsec status|grep -e none
       if [ "$?" == "0" ]
       then
        ipsec up a
        exit
        fi

if manual execution #./crontab.sh it is no problem

where is the problem?or are you have a good idea to do that?

thanks a lot .

Try using the full path to ipsec and grep in the script, and add #!/bin/sh as the first line.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.