Skip to content

Instantly share code, notes, and snippets.

@Hecatoncheir
Last active September 26, 2016 09:12
Show Gist options
  • Select an option

  • Save Hecatoncheir/8e9919d7c202d4123bdeb3514962ad47 to your computer and use it in GitHub Desktop.

Select an option

Save Hecatoncheir/8e9919d7c202d4123bdeb3514962ad47 to your computer and use it in GitHub Desktop.
Xvfb server like service
#!/bin/bash
#
# description: Xvfb server
#
# chkconfig: 345 99 01
# description: some startup script
# Get function from functions library
. /etc/init.d/functions
# Start the service Xvfb
start() {
echo -n "Starting Xvfb server: "
/usr/bin/Xvfb &
### Create the lock file ###
touch /var/lock/subsys/Xvfb
success $"Xvfb server startup"
echo
}
# Restart the service Xvfb
stop() {
echo -n "Stopping Xvfb server: "
killproc Xvfb
### Now, delete the lock file ###
rm -f /var/lock/subsys/Xvfb
echo
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status Xvfb
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment