Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: hamachi
- # Required-Start:
- # Required-Stop:
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: hamachi init script
- # Description: This file is used to start, stop, restart,
- # and determined status of the hamachi vpn service.
- # Author: iceflatline <iceflatline@gmail.com>
- ### END INIT INFO
- ### START OF SCRIPT
- set -e
- # PATH should only include /usr/* if it runs after the mountnfs.sh script
- PATH=/sbin:/usr/sbin:/bin:/usr/bin
- DESC="hamachi"
- NAME=hamachi
- DAEMON=/usr/bin/$NAME
- SCRIPTNAME=/etc/init.d/$NAME
- USER=<your username>
- # Exit if the hamachi package is not installed
- [ -x "$DAEMON" ] || exit 0
- # Load the VERBOSE setting and other rcS variables
- . /lib/init/vars.sh
- # Define LSB log_* functions.
- # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
- . /lib/lsb/init-functions
- # Function that starts the tuncfg daemon then hamachi
- start() {
- tuncfg && su $USER -c "hamachi start"
- }
- # Function that stops hamachi then kills the tuncfg daemon
- stop() {
- su $USER -c "hamachi stop" && kill $(pidof tuncfg)
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart|force-reload)
- log_daemon_msg "Restarting $DESC"
- stop
- start
- ;;
- status)
- status_of_proc "$DAEMON" "$NAME"
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}"
- ;;
- esac
- exit 0
- ### END OF SCRIPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement