#!/bin/sh # # $FreeBSD$ # # PROVIDE: mastodon_sidekiq # REQUIRE: NETWORKING DAEMON postgres # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to mastodon_sidekiq: # #mastodon_sidekiq_enable="YES" . /etc/rc.subr name="mastodon_sidekiq" rcvar="${name}_enable" command="/usr/local/bin/bundle exec sidekiq -c 25" command_interpreter="/usr/local/bin/ruby30" start_cmd="${name}_start" stop_cmd="${name}_stop" pid_file="/var/run/${name}.pid" mastodon_sidekiq_start(){ chdir /home/mastodon/live /usr/sbin/daemon -S -l daemon -s debug -T "${name}" -p "${pid_file}" \ -u mastodon \ /usr/bin/env -i \ "RAILS_ENV=production" "DB_POOL=25" "HOME=/home/mastodon" \ "MALLOC_ARENA_MAX=2" "USER=mastodon" "PATH=/usr/local/bin:${PATH}" $command } mastodon_sidekiq_stop(){ if [ -f "$pid_file" ]; then echo -n "Stopping services: ${name}" kill -s INT $(cat "$pid_file") echo "." else echo "It appears ${name} is not running." fi } load_rc_config ${name} run_rc_command "$1"