Gentoo下Nagios系统启动脚本

#!/sbin/runscript# Copyright 1999-2013 Gentoo Foundation# Distributed under the terms of the GNU General Public License v2# $Header: $depend() {need net}if [ -f /etc/rc.d/init.d/functions ]; then. /etc/rc.d/init.d/functionselif [ -f /etc/init.d/functions ]; then. /etc/init.d/functionsficheckconfig() {nagios_bin_file=/var/www/localhost/htdocs/nagios/bin/nagiosnagios_cfg_file=/var/www/localhost/htdocs/nagios/etc/nagios.cfgif [ ! -f "$nagios_bin_file" ]; thenecho "$nagios_bin_file is not exist."exit 1fiif [ ! -f "$nagios_cfg_file" ]; thenecho "$nagios_cfg_file is not exist."exit 1fi$nagios_bin_file -v $nagios_cfg_file > /dev/null 2>&1if [ $? -ne 0 ]; thenecho "please check your nagios configuration file."exit 1fi}start() {nagios_script_file=/var/www/localhost/htdocs/nagios/sbin/nagioscheckconfigebegin "starting nagios"start-stop-daemon --start --exec $nagios_script_fileeend $?}stop() {nagios_pid_file=/var/www/localhost/htdocs/nagios/var/nagios.lockebegin "Stopping nagios"start-stop-daemon --stop --retry 30 --pidfile $nagios_pid_fileeend $?}status() {nagios_run_path=/var/www/localhost/htdocs/nagios/varif [ ! -f $nagios_run_path/nagios.lock ]; thenecho "nagios is not running."elsenagios_pid_NO=`head -n 1 $nagios_run_path/nagios.lock`echo "nagios( pid:$nagios_pid_NO ) is running."fi}

Gentoo下ndo2db系统启动脚本

#!/sbin/runscript# Copyright 1999-2013 Gentoo Foundation# Distributed under the terms of the GNU General Public License v2# $Header: $depend() {need net}if [ -f /etc/rc.d/init.d/functions ]; then. /etc/rc.d/init.d/functionselif [ -f /etc/init.d/functions ]; then. /etc/init.d/functionsficheckconfig() {ndo2db_bin_file=/var/www/localhost/htdocs/nagios/bin/ndo2db-3xndo2db_cfg_file=/var/www/localhost/htdocs/nagios/etc/ndo2db.cfgif [ ! -f "$ndo2db_bin_file" ]; thenecho "$ndo2db_bin_file is not exist."exit 1fiif [ ! -f "$ndo2db_cfg_file" ]; thenecho "$ndo2db_cfg_file is not exist."exit 1fi}start() {ndo2db_script_file=/var/www/localhost/htdocs/nagios/sbin/ndo2dbcheckconfigebegin "starting ndo2db"start-stop-daemon --start --exec $ndo2db_script_fileeend $?}stop() {ndo2db_pid_file=/var/www/localhost/htdocs/nagios/var/ndo2db.lockebegin "Stopping ndo2db"start-stop-daemon --stop --retry 30 --pidfile $ndo2db_pid_fileeend $?}status() {ndo2db_run_path=/var/www/localhost/htdocs/nagios/varif [ ! -f $ndo2db_run_path/ndo2db.lock ]; thenecho "ndo2db service is not running."elsendo2db_pid_NO=`head -n 1 $ndo2db_run_path/ndo2db.lock`echo "ndo2db( pid:$ndo2db_pid_NO ) is running."fi}