Skip to content

Instantly share code, notes, and snippets.

@puhitaku
Last active March 9, 2022 11:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save puhitaku/15d3fa65753a2871e22668c95e134c3c to your computer and use it in GitHub Desktop.
Save puhitaku/15d3fa65753a2871e22668c95e134c3c to your computer and use it in GitHub Desktop.
Supervisor init script for OpenWrt (procd).
#!/bin/sh /etc/rc.common
#
# AUTHOR: Takumi Sueda <puhitaku@gmail.com>
#
# Start/stop/restart supervisor in OpenWrt.
START=91
USE_PROCD=0
PROG=/usr/bin/supervisord
DAEMON=${PROG}
# Location of the pid file
PIDFILE=/tmp/supervisord.pid
# Config of supervisor
CONFIG=/etc/supervisord.conf
start_service()
{
# $DAEMON -c $CONFIG -j $PIDFILE
procd_open_instance
procd_set_param command $PROG -c $CONFIG -j $PIDFILE
procd_set_param respawn
procd_close_instance
touch $CONFIG
}
stop_service()
{
kill $(cat $PIDFILE)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment