Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: Sakis3G
- # Required-Start: $all
- # Required-Stop: $all
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: Start/stop the Sakis3G service
- # Description: Sakis3G initscript that allows for Sakis3G to run at boot time as well as being stopped and started
- ### END INIT INFO
- set -e
- NAME="Sakis3G"
- PIDFILE="/var/run/sakis3g"
- DAEMON="/usr/bin/sakis3g"
- user=root
- ARGS="APN=\"CUSTOM_APN\" CUSTOM_APN=\"epc.tmobile.com\" FORCE_APN=\"epc.tmobile.com\" APN_USER=\"tmobile\" APN_PASS=\"password\" USBINTERFACE=\"0\""
- start() {
- if [ -e "$PIDFILE.pid" ]; then
- ## Program is running, exit with error.
- echo "Error! $NAME is currently running!" 1>&2
- exit 1
- else
- ## Change from /dev/null to something like /var/log/$PROG if you want to save output.
- /usr/bin/sakis3g connect $ARGS 2>&1 >/dev/null &
- echo "$NAME started"
- touch "$PIDFILE.pid"
- fi
- }
- stop() {
- if [ -e "$PIDFILE.pid" ]; then
- ## Program is running, so stop it
- /usr/bin/sakis3g disconnect 2>&1 >/dev/null &
- rm "$PIDFILE.pid"
- echo "$NAME stopped"
- else
- ## Program is not running, exit with error.
- echo "Error! $NAME not started!" 1>&2
- exit 1
- fi
- }
- ## Check to see if we are running as root first.
- ## Found at http://www.cyberciti.biz/tips/shell-root-user-check-script.html
- if [ "$(id -u)" != "0" ]; then
- echo "This script must be run as root" 1>&2
- exit 1
- fi
- case "$1" in
- start)
- start
- exit 0
- ;;
- stop)
- stop
- exit 0
- ;;
- status)
- echo -n "Getting status for "$NAME
- /usr/bin/sakis3g connect info &>/dev/null
- echo "\n"
- ;;
- restart)
- stop
- start
- sleep 1
- exit 0
- ;;
- *)
- echo "usage: $0 {start|stop|status|restart}"
- exit 1
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement