I'm trying to make a program run as a service under Debian Squeeze
(just to learn how to do that, I know crontab would be a better choice
for what I'm doing here, but I think it's ok as an example for
learning how to set up a service)
The service 'takepicture' just takes a picture from a camera every 15
minutes
This is how far I got:
### BEGIN INIT INFO
# Provides: takepicture
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
#!/bin/bash
PATH=/bin:/usr/bin
case "$1" in
start)
echo $$ > /tmp/takepicture.pid
while true
do
wget --http-user=root --http-passwd=bigsecret \
http://192.168.0.70/axis-cgi/jpg/image.cgi?resolutiond0x480
\
-O /home/jean/pictures/picture$(date +%F:%H:%M:%S).jpg
sleep 1500
done
;;
stop)
kill $(cat /tmp/takepicture.pid)
exit 0
;;
esac
I added it to the services running the command "insserv takepicture"
So far so good, but when I start it manually with the command "service
takepicture start"
I don't get my command prompt back as is usual when running other
services. How should the script be
modified to accomplish this.
thanks
jean
p.s.1 please don't answer "service take picture start &", that's not
what I want as other services in /etc/init.d don't have to be started
like that neither
p.s.2 I'm running Debian Squeeze
Replies