unifi_controller_rhel/templates/unifi.init.j2

53 lines
648 B
Django/Jinja
Executable File

#!/bin/bash
# chkconfig: 2345 95 20
# description: UniFi system
# processname: UniFi
ctrl_start()
{
java -jar {{ unifi_controller_rhel_unifi_prefix }}/UniFi/lib/ace.jar start &
}
ctrl_stop()
{
java -jar {{ unifi_controller_rhel_unifi_prefix }}/UniFi/lib/ace.jar stop &
}
ctrl_restart()
{
ctrl_stop
sleep 1
ctrl_start
}
case "$1" in
start)
echo -n "starting UniFi system"
ctrl_start
echo " service started"
;;
stop)
echo -n "stopping UniFi system"
ctrl_stop
echo " service stopped"
;;
restart)
echo -n "restarting UniFi system"
ctrl_restart
echo "service restarted"
;;
*)
echo "usage: service UniFi {start|stop|restart}"
;;
esac
exit 0