1 |
Hi people, |
2 |
I want my gentoo machine to check every 5 minutes the connection status. |
3 |
Therefor I wrote a shell script: |
4 |
|
5 |
----- |
6 |
|
7 |
#!/bin/bash |
8 |
#set -x |
9 |
|
10 |
dnsbroken=`ping -c1nqW5 -s8 mydomain.com 2>&1 | grep -e "unknown" -e |
11 |
"denied" -e "permited"` |
12 |
|
13 |
if [ -n "$dnsbroken" ] |
14 |
then |
15 |
|
16 |
# reconnect the connection |
17 |
/etc/init.d/net.ppp0 restart |
18 |
|
19 |
fi |
20 |
|
21 |
exit 0 |
22 |
|
23 |
---- |
24 |
|
25 |
to check if the connection exists, and if not restarts the init.ppp0 |
26 |
script. |
27 |
This script I made it root:root and permission: 500 |
28 |
|
29 |
on crontab: |
30 |
0-59/5 * * * * /usr/sbin/bash_ppp |
31 |
|
32 |
|
33 |
|
34 |
The problem: |
35 |
when the connection is down, even after 5 minutes or 10, the script |
36 |
isn't being executed, when I execute it by hand it works! |
37 |
|
38 |
|
39 |
Any ideas?! |
40 |
|
41 |
|
42 |
Tamer |