#! /bin/sh proc=scron crondir=/etc/scron killproc () { local sig=$1 pid=`ps | grep "${proc}.*${crondir}" | awk '{print $1}'` [ "$pid" != "" ] && kill $sig $pid } case "$1" in start) scron $crondir & ;; stop) killproc ;; restart) killproc scron $crondir & ;; *) echo "usage: $0 { start | stop | restart }" ;; esac