diff options
-rw-r--r-- | src/connections/ppp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/connections/ppp b/src/connections/ppp index 4a9b218..a82677b 100644 --- a/src/connections/ppp +++ b/src/connections/ppp @@ -17,7 +17,13 @@ ppp_up() { ppp_down() { load_profile "$1" - kill "$(head -1 "/var/run/ppp-$(basename $PEER).pid")" + PIDFILE="/var/run/ppp-$(basename $PEER).pid" + + if [[ -e $PIDFILE ]]; then + PID=$(head -1 $PIDFILE) + [[ -n "$PID" ]] && kill "$(head -1 $PIDFILE)" + fi + kill "$(head -1 $PIDFILE)" } ppp_$1 "$2" |