#!/bin/bash . /etc/rc.conf . /etc/rc.d/functions case "$1" in start) stat_busy "Starting p3scan" if [ -a /var/run/p3scan/p3scan.pid ]; then stat_die; fi # Start p3scan /usr/sbin/p3scan if ! [ -a /var/run/p3scan/p3scan.pid ]; then stat_die; fi add_daemon p3scan stat_done ;; stop) stat_busy "Stopping p3scan" # Stop p3scan if [ -a /var/run/p3scan/p3scan.pid ]; then kill `cat /var/run/p3scan/p3scan.pid` &>/dev/null || stat_die rm -f /var/run/p3scan/p3scan.pid rm_daemon p3scan stat_done else stat_fail fi ;; restart) $0 stop sleep 1 $0 start ;; *) echo "Usage: $0 { start | stop | restart }" esac exit 0