Hi Dave,
I need a script to check dsl0 availability and restart network daemon if the dsl0 not exist. Then put the script at cron job to run it every 30 minutes
Wong,
At the very basic level and guessing your dsl0 is your internet, all you really need is a ping check to a reliable server that excepts pings and then just check your connection every 60 seconds or so. If it is just for your use, why use cron, just start the check from your ~/.bashrc. Things can get as complicated as you want to make them, but something as simple as:
#!/bin/bash
runfile=/tmp/chkdsl0.run
cleanup() { rm $runfile }
trap cleanup trap cleanup SIGINT SIGTERM EXIT
if [[ ! -f $runfile ]]; then touch $runfile while :; do if ! ping -q -c1 yahoo.com &>/dev/null; then rcnetwork restart # (as root, or 'sudo rcnetwork restart' with sudo) fi sleep 60 done fi
exit 0
Thanks for your advise & useful script. I tried to run it foreground and get this message: /usr/local/sbin/dslcheck: line 9: trap: cleanup: invalid signal specification Is it oK? Please advise Thx & Rgds, Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org