I am trying to set init.d script for some service - let it be less
Here is my script:
#!/bin/bash -xv
# description: read service
#Source function library
if [ -x /etc/rc.d/init.d/functions ];then
. /etc/rc.d/init.d/functions
fi
RETVAL=0
LESS=/usr/bin/less
PIDFILE=/var/run/read.pid
start() {
echo -n $"Starting $LESS service: "
daemon /usr/bin/less
RETVAL=$?
echo $! > $PIDFILE;
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/LESS
echo
return $RETVAL
}
stop() {
echo -n $"Shutdown $LESS service: "
killproc /usr/bin/less
rm -f $PIDFILE
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/LESS
echo
return $RETVAL
}
restart() {
echo -n $"Restarting $LESS service: "
killproc /usr/bin/less
daemon /usr/bin/less
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
if [ `pidof /var/run/webreaderd.pid` ];then
echo "Running"
else
echo "Not running"
fi
;;
restart|reload)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit $?
But while debugging /etc/init.d/read.sh start
I got this error: line 15: daemon: command not found
despite the fact that my . /etc/rc.d/init.d/functions is present and it is not empty. How to make my daemon
function work?