summaryrefslogtreecommitdiff
path: root/doc/rc.d_cccms
blob: 678ae75f9b85497f97398ee615f7f73b5be0c89c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
#
# PROVIDE: cccms
# REQUIRE: LOGIN postgresql
# KEYWORD: shutdown

. /etc/rc.subr

name="cccms"
rcvar="cccms_enable"
desc="CCC CMS unicorn server"

cccms_dir="${cccms_dir:-/usr/local/www/cccms}"
cccms_unicorn_config="${cccms_unicorn_config:-/usr/local/etc/unicorn.rb}"

# command="/usr/local/rvm/gems/ruby-3.2.11@rails7-upgrade/wrappers/unicorn"
command="/usr/local/rvm/gems/ruby-3.2.11@rails8-upgrade/wrappers/unicorn"
command_args="-c ${cccms_unicorn_config} -E production -D"
cccms_chdir="${cccms_dir}"

pidfile="${cccms_pidfile:-${cccms_dir}/tmp/pids/unicorn.pid}"
procname="ruby"

required_dirs="${cccms_dir}"

extra_commands="reload"
sig_reload="USR2"

start_precmd="cccms_prestart"
cccms_prestart()
{
    mkdir -p /usr/local/www/cccms/tmp/pids /var/log
    touch /var/log/unicorn.stderr.log
    chown www:www /var/log/unicorn.stderr.log
}

export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
export RAILS_ENV=production
export HOME=/root

load_rc_config "${name}"
: ${cccms_enable:="NO"}

run_rc_command "$1"