#!/bin/bash

# 1) Copy this file to /etc/init.d:
#    $ sudo cp dsolard /etc/init.d
# 2) Create soft link for autostart and autostop
#    $ sudo ln -s /etc/init.d/dsolard /etc/rc3.d/S99dsolard
#    $ sudo ln -s /etc/init.d/dsolard /etc/rc5.d/S99dsolard
#    $ sudo ln -s /etc/init.d/dsolard /etc/rc0.d/K01dsolard
#    $ sudo ln -s /etc/init.d/dsolard /etc/rc6.d/K01dsolard
#    $ usermod -a -G dialout doro

set -e

. /lib/lsb/init-functions

case "$1" in
  start)
	log_daemon_msg "Start dSolard" "dsolard" || true
	start-stop-daemon --start --quiet --chdir /home/doro/dSolar/server --user doro -b -m --pidfile /home/doro/dSolar/server/dsolard.pid  --exec /home/doro/dSolar/server/dSolard
	;;
  stop)
	log_daemon_msg "Stopping dSolard" "dsolard" || true
	start-stop-daemon --stop --signal 3 --pidfile /home/doro/dSolar/server/dsolard.pid
	;;

  *)
	log_action_msg "Usage: /etc/init.d/dsolard {start|stop}" || true
	exit 1
esac

exit 0



