vpncloud/deb/vpncloud/debian/vpncloud.init

87 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
### BEGIN INIT INFO
# Provides: vpncloud
# Required-Start: $network $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: VpnCloud
# Description: VpnCloud - Peer-to-Peer VPN
### END INIT INFO
# Author: Dennis Schwerdel <schwerdel@informatik.uni-kl.de>
# Copyright (C) 2015-2016 Dennis Schwerdel
# This software is licensed unter GPL-3 or newer (see LICENSE.md)
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="VpnCloud" # Introduce a short description here
NAME=vpncloud # Introduce the short server's name here
SCRIPTNAME=/etc/init.d/$NAME
NETCONFIGS=/etc/vpncloud
# default settings
USER=root
GROUP=root
UMASK=022
CONTROL=$(which $NAME-control)
# Exit if the package is not installed
[ -x $CONTROL ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# 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
case "$1" in
start)
log_begin_msg "Starting $DESC" "$NAME"
$CONTROL start
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
stop)
log_begin_msg "Stopping $DESC" "$NAME"
$CONTROL stop
case "$?" in
0|1) log_end_msg 0; exit 0 ;;
2) log_end_msg 1; exit 2 ;;
esac
;;
status)
$CONTROL status
;;
restart|force-reload)
log_begin_msg "Restarting $DESC" "$NAME"
$CONTROL stop
case "$?" in
0|1)
$CONTROL start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac