-
-
Save Hacksore/48eb10ee35aab342f4cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: Xvfb | |
# Required-Start: $local_fs $syslog | |
# Required-Stop: $local_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start or stop Xvfb - X virtual framebuffer. | |
# Description: Start or stop Xvfb - X virtual framebuffer. | |
### END INIT INFO | |
NAME="Xvfb" | |
DESC="X virtual framebuffer" | |
XVFB=/usr/bin/$NAME | |
OPTIONS=":99 -screen 0 1024x768x16 -ac" | |
USER=debian-xvfb | |
MASK=0022 | |
PIDFILE=/var/run/$NAME.pid | |
SCRIPTNAME=/etc/init.d/$NAME | |
set -e | |
# Exit if the package is not installed | |
[ -x "$XVFB" ] || exit 0 | |
# Read configuration variable file if it is present | |
[ -r /etc/default/$NAME ] && . /etc/default/$NAME | |
# Define LSB log_* functions. | |
. /lib/lsb/init-functions | |
do_start() { | |
start-stop-daemon --start --background --quiet --oknodo --pidfile $PIDFILE --make-pidfile \ | |
--exec $XVFB --chuid $USER --umask $MASK -- $OPTIONS | |
} | |
do_stop() { | |
start-stop-daemon --stop --quiet --oknodo --retry=TERM/3/KILL/2 --pidfile $PIDFILE | |
RETVAL="$?" | |
rm -f $PIDFILE | |
return "$RETVAL" | |
} | |
case "$1" in | |
start) | |
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" | |
do_start | |
log_end_msg $? | |
;; | |
stop) | |
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" | |
do_stop | |
log_end_msg $? | |
;; | |
restart|force-reload) | |
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME" | |
$0 stop | |
sleep 1 | |
$0 start | |
;; | |
status) | |
status_of_proc -p $PIDFILE $XVFB $NAME | |
;; | |
*) | |
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment