diff options
Diffstat (limited to 'etc/nodist/nfs-functions')
-rwxr-xr-x | etc/nodist/nfs-functions | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/etc/nodist/nfs-functions b/etc/nodist/nfs-functions deleted file mode 100755 index 1f7b050..0000000 --- a/etc/nodist/nfs-functions +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -# -# An attempt at a simple, distribution-independent daemon management. -# -# Copyright (C) 2000-2001 Mission Critical Linux, Inc. -# - -# daemon functions -getpid() -{ - pid='' - if [ -f /var/run/${base}.pid ] - then - pid=`head -1 /var/run/${base}.pid` - fi - if [ "$pid" = "" ] - then - pid=`pidof $1` - fi - if [ "$pid" = "" ] - then - pid=`ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 } - { if ((prog == $5) || (("(" prog ")") == $5) || - (("[" prog "]") == $5) || - ((prog ":") == $5)) { print $1 ; exit 0 } }' $1` - fi - - echo $pid -} - -startdaemon() -{ - base=`basename $1` - - # check if it is already running - pid=`getpid $base` - [ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && echo " already running." && return - - # don't dump core - ulimit -c 0 - - $* && echo " done." || echo " failed." -} - -stopdaemon() -{ - base=`basename $1` - pid=`getpid $base` - - if [ "$pid" != "" ] - then - if ps h $pid>/dev/null 2>&1 - then - kill -TERM $pid - if ps h $pid>/dev/null 2>&1 - then - sleep 1 - if ps h $pid>/dev/null 2>&1 - then - sleep 3 - if ps h $pid>/dev/null 2>&1 - then - kill -KILL $pid - sleep 2 - fi - fi - fi - fi - ps h $pid >/dev/null 2>&1 - RC=$? - [ $RC -eq 0 ] && echo " failed." || echo " done." - [ $RC -eq 0 ] || rm -f /var/run/$base.pid >/dev/null 2>&1 - else - echo " not running." - fi -} - -daemonstatus() -{ - base=`basename $1` - pid=`getpid $base` - - if [ "$pid" != "" ] - then - if ps h $pid >/dev/null 2>&1 - then - echo "$base (pid $pid) is running." - return 0 - else - if [ -f /var/run/${base}.pid ] - then - echo "$base dead but pid file exists." - return 1 - else - echo "$base is stopped." - return 2 - fi - fi - else - echo "$base is stopped." - return 3 - fi -} - |