#!/bin/sh # # switcher start the video switcher daemon # # chkconfig: 345 97 24 # description: start the video switcher daemon # # Copyright © 2001-2006 Jamie Zawinski # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation. No representations are made about the suitability of this # software for any purpose. It is provided "as is" without express or # implied warranty. # # Created: 28-Jul-2001 ETCDIR=/Users/jwz/src/switcher/html switcher_conf=$ETCDIR/switcher.conf switcher_state=$ETCDIR/switcher.state sw_args="--file $switcher_conf --save $switcher_state --loop" #sw_args="$sw_args -vvv" #pc_args="$pc_args -vvv" # Source function library. #. /etc/rc.d/init.d/functions PATH=/sbin:$PATH PATH=/Users/jwz/src/switcher:$PATH export PATH # See how we were called. case "$1" in start) echo -n "Starting video switcher control..." switcher-cmd.pl $sw_args & echo "done." ;; stop) echo -n "Stopping switcher control..." # "killall" hates scripts... #killall switcher-cmd.pl pids=`ps auxww | \ grep 'switcher-cmd\.pl' | \ sed 's/ */ /g' | \ cut -d' ' -f2` pids=`echo $pids` if [ "$pids" != "" ]; then echo -n " ($pids) " kill $pids else echo -n " (nothing to kill) " fi echo "done." ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac