-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfreebsd-rc.d-1079
executable file
·48 lines (36 loc) · 1.01 KB
/
freebsd-rc.d-1079
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
45
46
47
48
#!/bin/sh
#
# Deploy as a file named "fingerd" in an rc.d dir
# PROVIDE: jail-fingerd
# REQUIRE: jail
. /etc/rc.subr
name="fingerd"
desc="run fingerd inside finger jail"
rcvar=fingerd_enable
load_rc_config ${name}
: ${fingerd_enable:=NO}
jail_name="finger"
jail_root="$(jls -j "${jail_name}" path)"
JID=$(jls -j ${jail_name} jid)
jail_fingerd="/srv/finger/bin/fingerd"
jailed_pidfile="/log/pids/fingerd.pid"
logs_dir="${jail_root}/log"
pid_dir="${logs_dir}/pids"
pid_dir_owner="nobody"
runtime_user_nonjail="nobody"
listen_spec=":1079"
command="${jail_fingerd}"
start_cmd="fingerd_start"
start_precmd="fingerd_prestart"
pidfile="${jail_root}${jailed_pidfile}"
fingerd_prestart() {
mkdir -p -m 0755 "${pid_dir}"
chown "${pid_dir_owner}" "${pid_dir}"
}
fingerd_start() {
# "jexec -l" adds a chdir(HOME) so fails
daemon -c jexec -u ${runtime_user_nonjail} ${jail_name} \
${jail_fingerd} -listen ${listen_spec} -pidfile=${jailed_pidfile} \
>>${logs_dir}/stdout 2>>${logs_dir}/stderr </dev/null
}
run_rc_command "$1"