]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/connectd
7 # Stop if nothing is configured
8 if [ ! -s "/var/ipfire/ppp/settings" ];then
12 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/ppp
/settings
)
17 if [ ! $HOLDOFF ]; then
21 if [ "$RECONNECTION" = "dialondemand" ]; then
26 logger
-t $
(basename $0)[$$
] $
*
29 msg_log
"Connectd ($1) started with PID $$"
32 if [ -s "/var/ipfire/red/keepconnected" ]; then
33 ATTEMPTS
=$
(cat /var
/ipfire
/red
/keepconnected
)
35 echo "0" > /var
/ipfire
/red
/keepconnected
40 boot_mesg
"Starting connection daemon..."
43 while [ "$COUNT" -lt "$MAX" ]; do
44 if [ ! -e "/var/ipfire/red/keepconnected" ]; then
45 # User pressed disconnect in gui
46 msg_log
"Stopping by user request. Exiting."
47 /etc
/rc.d
/init.d
/network stop red
50 if [ -e "/var/ipfire/red/active" ]; then
51 # Successfully connected in time
52 echo "0" > /var
/ipfire
/red
/keepconnected
53 msg_log
"System is online. Exiting."; exit 0
55 if ( ! ps ax |
grep -q [p
]ppd
); then
56 msg_log
"No pppd is running. Trying reconnect."
57 break # because pppd died
63 /etc
/rc.d
/init.d
/network stop red
66 msg_log
"Reconnecting: Attempt ${ATTEMPTS} of ${MAXRETRIES}"
67 if [ "${ATTEMPTS}" -ge "${MAXRETRIES}" ]; then
68 echo "0" > /var
/ipfire
/red
/keepconnected
69 if [ "$BACKUPPROFILE" != '' ]; then
70 rm -f /var
/ipfire
/ppp
/settings
71 cp "/var/ipfire/ppp/settings-${BACKUPPROFILE}" /var
/ipfire
/ppp
/settings
72 msg_log
"Switched to backup profile ${BACKUPPROFILE}"
73 # to be shure the right secrets are used
74 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/ppp
/settings-
${BACKUPPROFILE})
75 echo "'$USERNAME' * '$PASSWORD'" > /var
/ipfire
/ppp
/secrets
77 msg_log
"No backup profile given. Exiting."
81 echo $ATTEMPTS > /var
/ipfire
/red
/keepconnected
84 /etc
/rc.d
/init.d
/network start red
>/dev
/tty12
2>&1 </dev
/tty12
&
88 while ( ps ax |
grep -q [p
]ppd
); do
89 msg_log
"There is a pppd still running. Waiting 2 seconds for exit."
93 /etc
/rc.d
/init.d
/network restart red
97 echo "Usage: $0 {start|reconnect}"
102 msg_log
"Exiting gracefully connectd with PID $$."