mdserver-web/plugins/apache/init.d/httpd.tpl

47 lines
1.1 KiB
Smarty
Raw Normal View History

2026-04-11 04:56:03 -04:00
#!/bin/bash
# chkconfig: 345 85 15
# description: Apache Server
2026-04-11 04:18:12 -04:00
### BEGIN INIT INFO
2026-04-11 04:56:03 -04:00
# Provides: apache
# Required-Start: $network
# Required-Stop: $network
2026-04-11 04:18:12 -04:00
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
2026-04-11 04:56:03 -04:00
# Description: Apache Server
2026-04-11 04:18:12 -04:00
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/homebrew/bin
2026-04-11 04:56:03 -04:00
# Apache 可执行文件的路径
2026-04-11 07:10:59 -04:00
DAEMON={$SERVER_PATH}/apache/httpd/bin/httpd
2026-04-11 04:56:03 -04:00
# 进程的 PID 文件路径
2026-04-11 07:10:59 -04:00
PIDFILE={$SERVER_PATH}/apache/httpd/logs/httpd.pid
2026-04-11 04:18:12 -04:00
2026-04-11 04:56:03 -04:00
# 根据传入的参数执行不同操作
2026-04-11 04:18:12 -04:00
case "$1" in
start)
2026-04-11 04:56:03 -04:00
echo "Starting Apache..."
$DAEMON -k start
2026-04-11 04:18:12 -04:00
;;
stop)
2026-04-11 04:56:03 -04:00
echo "Stopping Apache..."
$DAEMON -k stop
2026-04-11 04:18:12 -04:00
;;
restart)
2026-04-11 04:56:03 -04:00
echo "Restarting Apache..."
$DAEMON -k restart
2026-04-11 04:18:12 -04:00
;;
2026-04-11 04:56:03 -04:00
status)
if [ -f $PIDFILE ]; then
echo "Apache is running."
else
echo "Apache is not running."
fi
2026-04-11 04:18:12 -04:00
;;
*)
2026-04-11 04:56:03 -04:00
echo "Usage: $0 {start|stop|restart|status}"
2026-04-11 04:18:12 -04:00
exit 1
esac
2026-04-11 04:56:03 -04:00
exit 0