📄 restart.cgi
字号:
#!/usr/local/bin/perl# restart.cgi# Send a SIGHUP to apacherequire './apache-lib.pl';&ReadParse();&error_setup($text{'restart_err'});$conf = &get_config();$pidfilestr = &find_directive_struct("PidFile", $conf);$pidfile = $pidfilestr ? $pidfilestr->{'words'}->[0] : "logs/httpd.pid";$pidfile = &server_root($pidfile, $conf);if (-x $config{'apachectl_path'}) { # use apachectl to restart $out = `$config{'apachectl_path'} restart 2>&1`; if ($out !~ /httpd restarted/) { &error("<tt>$out</tt>"); } }else { # send SIGHUP directly open(PID, $pidfile) || &error(&text('restart_epid', $pidfile)); <PID> =~ /(\d+)/ || &error(&text('restart_epid2', $pidfile)); close(PID); kill('HUP', $1) || &error(&text('restart_esig', $1)); }# Check if restart was successful.. some config file error may have caused it# to silently failsleep(1);if (!open(PID, $pidfile) || <PID> !~ /(\d+)/ || !kill(0, $1)) { # Not running.. find out why $errorlogstr = &find_directive_struct("ErrorLog", $conf); $errorlog = $errorlogstr ? $errorlogstr->{'words'}->[0] : "logs/error_log"; if ($errorlog eq 'syslog' || $errorlog =~ /^\|/) { &error($text{'restart_eunknown'}); } else { $errorlog = &server_root($errorlog, $conf); $out = `tail -5 $errorlog`; &error("<pre>$out</pre>"); } }&redirect($in{'redir'});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -