#!/bin/sh
#
# startfile for optware cron, by newbiefan @ wl500g.info
# For Olegs & Ily's FW for Asus Routers
# store this script in /opt/etc/init.d if you've installed optware

# Prgmname=/full_path/Prgmname
prgmname="/opt/sbin/cron"
shortname="cron"

#configfile=/full_path/configfile or in case of needed options: "-D -s /opt/etc/smb.conf"
#configfile=""

#location of pid-file, if any, configure stop function of this script  
pidfile="/opt/var/run/cron.pid"

###########################End of Script configuration###################

start() {
        # Code here to start the program
        ${prgmname} ${configfile}
        logger -t cron "service started"
        return 0
}

stop() {
        # Code here to stop the program and check it's dead
        [ -f $pidfile ] && kill `cat $pidfile` && rm -f $pidfile
        logger -t cron "service stopped"
        return 0
}
##########################start here##########################
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        logger -t $shortname "restart, executed from $(whoami)"
        stop
        sleep 2
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac

