"Fossies" - the Fresh Open Source Software Archive

Member "unix/NetBSD/pandora_agent" (17 May 2019, 1015 Bytes) of package /linux/misc/pandorafms_agent_unix-7.0NG.740.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. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 
    3 # **********************************************************************
    4 # Pandora FMS Agent Daemon launcher for NetBSD
    5 # (c) 2013 Hiroki SHIMIZU <shimizu@rworks.jp>
    6 #
    7 # **********************************************************************
    8 
    9 # PROVIDE: pandora_agent
   10 # REQUIRE: LOGIN
   11 # KEYWORD: shutdown
   12 
   13 # Add the following line to /etc/rc.conf to enable `pandora_agent':
   14 #
   15 # pandora_agent="YES"
   16 #
   17 
   18 . "/etc/rc.subr"
   19 
   20 name="pandora_agent"
   21 rcvar=${name}
   22 
   23 # read configuration and set defaults
   24 pandora_agent=${pandora_agent:-"NO"}
   25 load_rc_config "$name"
   26 
   27 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
   28 
   29 command=/usr/local/bin/pandora_agent
   30 command_args="/usr/local/etc/pandora &"
   31 
   32 pidfile=/var/run/$name.pid
   33 required_files="/usr/local/etc/pandora/pandora_agent.conf"
   34 start_postcmd=start_postcmd
   35 stop_postcmd=stop_postcmd
   36 
   37 procname="/usr/pkg/bin/perl"
   38 
   39 start_postcmd()
   40 {
   41     sleep 1
   42     PANDORA_PID=`pgrep -f none $name`
   43     echo $PANDORA_PID > $pidfile
   44 }
   45 
   46 stop_postcmd()
   47 {
   48     rm -f $pidfile
   49 }
   50 
   51 run_rc_command "$1"