Lines 1-84
Link Here
|
1 |
#!/bin/sh |
|
|
2 |
|
3 |
# PROVIDE: rundeck |
4 |
# REQUIRE: LOGIN |
5 |
# KEYWORD: shutdown |
6 |
|
7 |
# |
8 |
# Configuration settings for rundeck in /etc/rc.conf: |
9 |
# |
10 |
# rundeck_enable (bool): |
11 |
# Set to "NO" by default. |
12 |
# Set it to "YES" to enable rundeck |
13 |
# |
14 |
# rundeck_args (str): |
15 |
# Extra arguments passed to start command |
16 |
# |
17 |
# rundeck_home (str) |
18 |
# Set to "%%RUNDECK_HOME%%" by default. |
19 |
# Set the RUNDECK_HOME variable for rundeck process |
20 |
# |
21 |
# rundeck_java_home (str): |
22 |
# Set to "%%JAVA_HOME%%" by default. |
23 |
# Set the Java virtual machine to run rundeck |
24 |
# |
25 |
# rundeck_java_opts (str): |
26 |
# Set to "" by default. |
27 |
# Java VM args to use. |
28 |
# |
29 |
# rundeck_user (str): |
30 |
# Set to "%%RUNDECK_USER%%" by default. |
31 |
# User to run rundeck as. |
32 |
# |
33 |
# rundeck_group (str): |
34 |
# Set to "%%RUNDECK_GROUP%%" by default. |
35 |
# Group for data file ownership. |
36 |
# |
37 |
# rundeck_log_file (str): |
38 |
# Set to "%%RUNDECK_LOG_FILE%%" by default. |
39 |
# Log file location. |
40 |
# |
41 |
|
42 |
. /etc/rc.subr |
43 |
|
44 |
name="rundeck" |
45 |
rcvar=rundeck_enable |
46 |
|
47 |
load_rc_config "${name}" |
48 |
|
49 |
: ${rundeck_args="-b %%RUNDECK_HOME%%"} |
50 |
: ${rundeck_enable="NO"} |
51 |
: ${rundeck_home="%%RUNDECK_HOME%%"} |
52 |
: ${rundeck_java_home="%%JAVA_HOME%%"} |
53 |
: ${rundeck_user="%%RUNDECK_USER%%"} |
54 |
: ${rundeck_group="%%RUNDECK_GROUP%%"} |
55 |
: ${rundeck_log_file="%%RUNDECK_LOG_FILE%%"} |
56 |
|
57 |
pidfile="/var/run/rundeck/rundeck.pid" |
58 |
command="/usr/sbin/daemon" |
59 |
java_cmd="${rundeck_java_home}/bin/java" |
60 |
procname="${java_cmd}" |
61 |
command_args="-p ${pidfile} ${java_cmd} ${rundeck_java_opts} -jar %%DATADIR%%/rundeck-launcher.jar ${rundeck_args} > ${rundeck_log_file} 2>&1" |
62 |
required_files="${java_cmd}" |
63 |
|
64 |
start_precmd="rundeck_prestart" |
65 |
start_cmd="rundeck_start" |
66 |
|
67 |
rundeck_prestart() { |
68 |
if [ ! -f "${rundeck_log_file}" ]; then |
69 |
touch "${rundeck_log_file}" |
70 |
chown "${rundeck_user}:${rundeck_group}" "${rundeck_log_file}" |
71 |
chmod 640 "${rundeck_log_file}" |
72 |
fi |
73 |
if [ ! -d "/var/run/rundeck" ]; then |
74 |
install -d -o "${rundeck_user}" -g "${rundeck_group}" -m 750 "/var/run/rundeck" |
75 |
fi |
76 |
} |
77 |
|
78 |
rundeck_start() |
79 |
{ |
80 |
check_startmsgs && echo "Starting ${name}." |
81 |
su -l ${rundeck_user} -c "exec ${command} ${command_args} ${rc_arg}" |
82 |
} |
83 |
|
84 |
run_rc_command "$1" |