"Fossies" - the Fresh Open Source Software Archive

Member "fake-1.1.11/heartbeat/fake" (8 Jul 2009, 874 Bytes) of package /linux/misc/old/fake-1.1.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 #
    3 # /etc/ha.d/resource.d/fake     - a heartbeat resource file
    4 #
    5 # We can pipe every output of fake to /dev/null because it appears
    6 # in the syslog, too.
    7 #
    8  
    9 set -u
   10 
   11 usage () {
   12         echo "Usage: $0 {start|stop|restart|status}"
   13         exit 1
   14 }
   15  
   16 if [ "$#" != 2 ]; then
   17         usage;
   18 fi
   19 
   20 case "$2" in
   21         start)
   22                 touch /var/run/fake.$1
   23                 nohup fake $1 >/dev/null 2>&1 &
   24         ;;
   25         stop)
   26                 rm -f /var/run/fake.$1
   27                 fake remove $1 >/dev/null 2>&1
   28         ;;
   29         restart)
   30                 $0 stop
   31                 $0 start
   32         ;;
   33         status)
   34                 if [ -f /var/run/fake.$1 ]; then
   35                         echo running
   36                 else
   37                         echo stopped
   38                 fi
   39         ;;
   40         *)
   41                 usage;
   42         ;;
   43 esac
   44 
   45 exit 0
   46 # vim: ts=4