#!/bin/sh
########################################################################
# Begin fcron
#
# Description : Manage fcron daemon
# Author      : OldCoder
# Version     : 190513
#
########################################################################

### BEGIN INIT INFO
# Provides:            fcron
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start:       3 4 5
# Default-Stop:        0 1 2 6
# Short-Description:   Manages the fcron daemon.
# Description:         Manages the fcron daemon.
### END INIT INFO

. /lib/lsb/init-functions

case "$1" in
   start)
      log_info_msg "Starting fcron"
      pkill fcron
      sureterm fcron
      fcron -f --nosyslog --logfilepath /var/log/fcron >& /dev/null &
      evaluate_retval
      ;;

   restart)
      log_info_msg "Restarting fcron"
      pkill "fcron.*log"
      sureterm fcron
      fcron -f --nosyslog --logfilepath /var/log/fcron >& /dev/null &
      evaluate_retval
      ;;

   stop)
      log_info_msg "Stopping fcron"
      pkill fcron
      sureterm fcron
      evaluate_retval
      ;;

   status)
      statusproc fcron
      ;;

   *)
      echo "Usage: $0 {start|stop|restart|status}"
      exit 1
      ;;

esac

# End /etc/init.d/fcron
