Home / Kppp script for connect and disconnect

To be connected to internet with Kppp, you should start Kppp and type ENTER to connect.
To be disconnected, you should right click on kppp icon and click to right option.
It is too much work ;-)
It's why I've done this script.
Launch the script: kppp will be started and will directly connect you.
Relaunch the script and you're now disconnected!
Then, assign Ctrl+Alt+P to this script (by using KHotKeys) and enjoy connection and disconnection with a single key-press :-D

The script

#!/bin/sh
#
# This script start kppp and directly connect you.
# And if you are already connected, it disconnect you automatically.
#

##
## First, please configure this:
## Normally, you just need to edit the account name (Free50H)
##

# Connection command:
connect_cmd='kppp -c Free50H'

# Disconnection command:
disconnect_cmd='kppp -k'

# Path of the kppp lock file:
lock_file="$HOME/.kde/share/apps/kppp/kppp.pid"

##
## Now, run the script:
##

if [ -f $lock_file ]
then
  $disconnect_cmd
else
  $connect_cmd
fi

How to Use It

First, you must edit it (copy / paste to your text editor, for example) to have the good paths and the good account name.
Then, just save this script as /usr/bin/kpppc for example and switch on the execution bit (with the command chmod +x kpppc or by file Properties / Permitions / "Is executable" in a desktop environment).
If you want, assign an hotkey to this script.
If you don't have persmission to write in /usr/bin, you can copy it to your desktop and launch it from there.
That's all: like it.