Hi Mats ... please see my comment below. Mats Kindahl wrote:
[snip] >>> >>> which uses the inadyn-client script (that I wrote), containing the >>> following lines (code edited): >>> >>> #!/sbin/sh >>> >>> . /lib/svc/share/smf_include.sh >>> >>> NAME=inadyn >>> DAEMON=/usr/local/bin/$NAME >>> . >>> . >>> . >>> case $1 in >>> start) >>> if [ ! -x $DAEMON ]; then >>> echo "$DAEMON is not executable, not starting" >>> exit $SMF_EXIT_ERR_CONFIG >>> fi >>> if [ ! -r $CONF ]; then >>> echo "$CONF not readable, not starting" >>> exit $SMF_EXIT_ERR_CONFIG >>> fi >>> if pgrep $NAME >/dev/null; then >>> echo "'$NAME' is already running" I suspect the problem is how you are using pgrep(1) here. Please note, that if you do "pgrep inadyn", it'll match not only process with name inadyn, but also your SMF method script called inadyn-script (which is running at the time you're doing the check). That's why the script says that "inadyn is already running" even though you checked before that inadyn is not running. Please note the -x option for pgrep(1): -x Considers only processes whose argument string or executable file name exactly matches the specified pattern to be matching processes. The pattern match is considered to be exact when all characters in the process argument string or executable file name match the pattern. Hope that helps! Cheers, Tomas >>> else >>> $DAEMON & >>> sleep 1 >>> fi >>> ;; >>> . >>> . >>> . >>> esac >>> >>> exit $SMF_EXIT_OK >>> [snip]