Commit dbd76f7a authored by Daniel van Dorp's avatar Daniel van Dorp Committed by Matt Holt

dist/init/linux-sysvinit: process @weingart's feedback (#1008)

* dist/init/linux-sysvinit: use kill -0 to test process status

* dist/init/linux-sysvinit: use service (as root) instead of /etc/init.d/
parent e081d8b5
...@@ -8,4 +8,4 @@ Usage ...@@ -8,4 +8,4 @@ Usage
* Save the SysVinit config file in `/etc/init.d/caddy`. * Save the SysVinit config file in `/etc/init.d/caddy`.
* Ensure that the folder `/etc/caddy` exists and that the subfolder `ssl` is owned by `www-data`. * Ensure that the folder `/etc/caddy` exists and that the subfolder `ssl` is owned by `www-data`.
* Create a Caddyfile in `/etc/caddy/Caddyfile` * Create a Caddyfile in `/etc/caddy/Caddyfile`
* Now you can use `sudo /etc/init.d/caddy start|stop|restart|reload|status`. * Now you can use `service caddy start|stop|restart|reload|status` as `root`.
...@@ -53,11 +53,10 @@ reload() { ...@@ -53,11 +53,10 @@ reload() {
status() { status() {
if [ -f $PIDFILE ]; then if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE` if kill -0 $(cat "$PIDFILE"); then
if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
echo "$NAME process is dead, but pidfile exists"
else
echo "$NAME is running" echo "$NAME is running"
else
echo "$NAME process is dead, but pidfile exists"
fi fi
else else
echo "$NAME is not running" echo "$NAME is not running"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment