"Fossies" - the Fresh Open Source Software Archive

Member "pandora_server/FreeBSD/pandora_server" (15 Sep 2021, 1875 Bytes) of package /linux/misc/pandorafms_server-7.0NG.757.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. See also the latest Fossies "Diffs" side-by-side code changes report for "pandora_server": 7.0NG.756_vs_7.0NG.757.

    1 #!/bin/sh
    2 
    3 # **********************************************************************
    4 # Pandora FMS Server Daemon launcher through pandora_ha for FreeBSD
    5 # (c) 2010-2021 Junichi Satoh <junichi@rworks.jp>
    6 # (c) 2014 Koichiro Kikuchi <koichiro@rworks.jp>
    7 #
    8 # **********************************************************************
    9 
   10 # PROVIDE: pandora_server
   11 # REQUIRE: LOGIN mysql
   12 # KEYWORD: shutdown
   13 
   14 # Add the following lines to /etc/rc.conf to enable pandora_server:
   15 # pandora_server_enable (bool):  Set to "YES" to enable pandora_server (default: NO)
   16 #
   17 
   18 . "/etc/rc.subr"
   19 
   20 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
   21 
   22 name="pandora_ha"
   23 rcvar=pandora_server_enable
   24 
   25 : ${pandora_server_enable:=NO}
   26 : ${pandora_server_configfile:=/usr/local/etc/pandora/pandora_server.conf}
   27 
   28 command=/usr/local/bin/pandora_ha
   29 command_pandora=/usr/local/bin/pandora_server
   30 command_interpreter=/usr/local/bin/perl
   31 _pidprefix=/var/run/pandora_ha
   32 _pidprefix_pandora=/var/run/pandora_server
   33 pidfile=${_pidprefix}.pid
   34 pidfile_pandora=${_pidprefix_pandora}.pid
   35 required_files="$pandora_server_configfile"
   36 extra_commands="status_server start_server stop_server restart_server"
   37 
   38 stop_postcmd=stop_postcmd
   39 
   40 status_server_cmd=control_pandora_server
   41 start_server_cmd=control_pandora_server
   42 stop_server_cmd=control_pandora_server
   43 restart_server_cmd=control_pandora_server
   44 
   45 load_rc_config $name
   46 
   47 control_pandora_server() {
   48     local name command pidfile
   49     name="pandora_server"
   50     command=$command_pandora
   51     pidfile=$pidfile_pandora
   52     pandora_server_flags="-D $pandora_server_flags -P $pidfile_pandora $pandora_server_configfile"
   53     pandora_arg=`echo $rc_arg | sed 's/_server//g'`
   54     unset "${pandora_arg}_cmd" "${pandora_arg}_precmd" "${pandora_arg}_postcmd"
   55     run_rc_command $pandora_arg
   56 }
   57 
   58 stop_postcmd()
   59 {
   60         rm -f $pidfile
   61 }
   62 
   63 pandora_ha_flags="-d -p $pidfile $pandora_server_configfile"
   64 
   65 run_rc_command "$1"