nagios监控文件start_perl_cgi.sh
例子,start_perl_cgi.sh文件的内容:
复制代码代码示例:
#!/bin/bash
(责任编辑:IT)# #site: www.jbxue.com set -x dir=/export/servers/nginx stop () { #pkill -f $dir/perl-fcgi.pl kill $(cat $dir/logs/perl-fcgi.pid) rm $dir/logs/perl-fcgi.pid 2>/dev/null rm $dir/logs/perl-fcgi.sock 2>/dev/null echo "stop perl-fcgi done" } start () { rm $dir/now_start_perl_fcgi.sh 2>/dev/null chown nagios.nagios $dir/logs echo "$dir/perl-fcgi.pl -l $dir/logs/perl-fcgi.log -pid $dir/logs/perl-fcgi.pid -S $dir/logs/perl-fcgi.sock" >>$dir/now_start_perl_fcgi.sh chown nagios.nagios $dir/now_start_perl_fcgi.sh chmod u+x $dir/now_start_perl_fcgi.sh sudo -u nagios $dir/now_start_perl_fcgi.sh echo "start perl-fcgi done" } case $1 in stop) stop ;; start) start ;; restart) stop start ;; esac |