Skip to content

Instantly share code, notes, and snippets.

@jonathonbyrdziak
Created November 22, 2013 22:42
Show Gist options
  • Save jonathonbyrdziak/7608137 to your computer and use it in GitHub Desktop.
Save jonathonbyrdziak/7608137 to your computer and use it in GitHub Desktop.
OpenVZ Web Panel Daemon allows you to start the hw-daemon.rb on server reboot.
#! /bin/sh
# /etc/init.d/owpd
#
# chkconfig: 2345 85 15
# description: OWP Daemon
# processname: OWP Daemon
#
# Install the service with chkconfig --add owpd
#
# Define where owp is installed.
# The trailing slash is required ( Example : /my/path/bin/ )
OWP_DIRECTORY=/opt/ovz-web-panel/utils/hw-daemon/
# Source function library.
. /etc/init.d/functions
DAEMON="${OWP_DIRECTORY}hw-daemon.rb"
start() {
cd $OWP_DIRECTORY;
ruby $DAEMON start
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/owpd
return $RETVAL
}
stop() {
echo "Stopping OVZ Web Panel Daemon..."
ruby $DAEMON stop
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/owpd
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment