#!/bin/sh
#
# DESCRIPTION
#
#   Startup init script for BackupPC for solaris.
#
# Distributed with BackupPC version 4.4.0, released 20 Jun 2020.
#
# Not tested...
#

start() {
    #
    # You can set the SMB share password here is you wish.  Otherwise
    # you should put it in the config.pl script.
    # If you put it here make sure this file has no read permissions
    # for normal users!  See the documentation for more information.
    #
    #BPC_SMB_PASSWD=
    #export BPC_SMB_PASSWD
    #
    su __BACKUPPCUSER__ -c "__INSTALLDIR__/bin/BackupPC -d"
}

stop() {
    /usr/bin/pkill -f "__INSTALLDIR__/bin/BackupPC -d"
}

restart() {
    stop
    start
}

reload() {
    /usr/bin/pkill -1 -f "__INSTALLDIR__/bin/BackupPC -d"
}

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart)
  	restart
	;;
  reload)
  	reload
	;;
  *)
	echo "Usage: $0 {start|stop|restart|reload}"
	exit 1
esac

exit $?
