我有一个脚本,检查是否PPTP VPN正在运行,如果没有它重新连接PPTP VPN,当我手动运行该脚本让它执行罚款,当我设置一个cron作业,没有运行
* * * * * /bin/bash /var/scripts/vpn-check.sh
Run Code Online (Sandbox Code Playgroud)
脚本来了:
#!/bin/sh
/bin/ping -c3 192.168.17.27 > /tmp/pingreport
result=`grep "0 received" /tmp/pingreport`
truncresult="`echo "$result" | sed 's/^\(.................................\).*$$'`"
if [[ $truncresult == "3 packets transmitted, 0 received" ]]; then
/usr/sbin/pppd call home
fi
Run Code Online (Sandbox Code Playgroud)