I have to run a C program using monit. so I had to demonize it. what i did was i took a daemon template made some changes and arrived at this file as below, which is a script file:
# Source function library
. /home/stallions/queue.c
# Do preliminary checks here, if any
#### START of preliminary checks #########
##### END of preliminary checks #######
# Handle manual control parameters like start, stop, status, restart, etc.
case "$1" in
start)
# Start daemons.
echo -n $"Starting queue daemon: "
echo
daemon queue
echo
;;
stop)
# Stop daemons.
echo -n $"Shutting down queue: "
killproc queue
echo
# Do clean-up works here like removing pid files from /var/run, etc.
;;
status)
status queue
;;
restart)
$0 stop
$0 start
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
when i execute this file # ./queue i get errors
# line 8: 'void fifoinit(int size)'
# line 8: syntax error near unexpected token
I am not sure what should be the source function library path. I have given it the path where my original queue.c exits which i wanted to run it as a daemon. Can you ell me should there be anything else to be done to run this as a daemon and how to correct the errors?