Last active
November 2, 2023 12:09
-
-
Save kotashiratsuka/d4830a88466f783a06b39055f4c67337 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# PROVIDE: sidekiq | |
# REQUIRE: LOGIN DAEMON NETWORKING redis | |
# KEYWORD: shutdown | |
# | |
# Add the following lines to /etc/rc.conf to enable sidekiq: | |
# sidekiq_enable (bool): Set to "NO" by default. | |
# Set it to "YES" to enable sidekiq | |
# | |
. /etc/rc.subr | |
name="sidekiq" | |
rcvar=sidekiq_enable | |
load_rc_config ${name} | |
: ${sidekiq_enable:="NO"} | |
: ${sidekiq_user:="redmine"} | |
: ${sidekiq_chdir:="/home/redmine"} | |
: ${sidekiq_env:="PATH=$PATH:/usr/local/bin"} | |
pidfile="${sidekiq_chdir}/tmp/pids/sidekiq.pid" | |
logfile="${sidekiq_chdir}/log/sidekiq.log" | |
config="${sidekiq_chdir}/config/sidekiq.yml" | |
procname="/usr/local/bin/bundle" | |
procname_args="exec sidekiq -e production -C ${config}" | |
command="/usr/sbin/daemon" | |
command_args="-p ${pidfile} -H -o ${logfile} ${procname} ${procname_args}" | |
stop_cmd="${name}_stop" | |
status_cmd="${name}_status" | |
restart_cmd="${name}_restart" | |
sidekiq_stop() { | |
pkill -F "${pidfile}" | |
} | |
sidekiq_status() | |
{ | |
if [ -f "${pidfile}" ]; then | |
echo "${name} is running as pid `pgrep -F ${pidfile}`." | |
else | |
echo "${name} not running?" | |
fi | |
} | |
sidekiq_restart() { | |
run_rc_command stop | |
while [ -f "${pidfile}" ]; do | |
false | |
done | |
run_rc_command start | |
} | |
run_rc_command "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment