#!/bin/sh # # chkconfig: 345 90 10 # description: Starts and stops the LiveCamera service. # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network PROGNAME1=ffserver PROGNAME2=ffmpeg PROGRAM1="/usr/local/bin/ffserver -f /usr/local/etc/ffserver.conf" PROGRAM2="/usr/local/bin/ffmpeg -s 320x240 -vd /dev/video0 http:localhost:8090/feed1.ffm" # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 # See how we were called. case "$1" in start) echo -n "Starting LiveCamera services: " ${PROGRAM1} > /dev/null 2>&1 & if [ $? != 0 ]; then exit 1 fi sleep 2 ${PROGRAM2} > /dev/null 2>&1 & if [ $? != 0 ]; then killproc ${PROGNAME1} exit 1 fi echo "" ;; stop) echo -n "Shutting down LiveCamera services: " killproc ${PROGNAME2} killproc ${PROGNAME1} echo "" ;; restart) echo -n "Restarting LiveCamera services: " $0 stop $0 start echo "done." ;; *) echo "Usage: livecam {start|stop|restart}" exit 1 esac exit 0