pduan1209
shell+crontab做自动运行!
我有一段程序:
#!/bin/bash
IP="echo $(ifconfig tun5|awk '/inet/ {split ($2,x,":");print x[2]}')"
MYIP="10.6.0.2"
if [ "$IP" == "$MYIP" ]
then
echo This appears to be a tarball.
echo $IP
else
/etc/openvpn/openvpn-startup.sh &
fi
名为test.sh
我在用CRONTAB -E
*/2 * * * * /etc/test.sh
但是过了2分钟都不会执行,请大家帮帮看一下是什么地方错了
寂寞烈火
IP="echo $(ifconfig tun5|awk '/inet/ {split ($2,x,":");print x[2]}')"
把双引号换成反引号
IP=`echo $(ifconfig tun5|awk '/inet/ {split ($2,x,":");print x[2]}')`