summaryrefslogtreecommitdiff
path: root/sysutils/immortal/files/immortaldir.in
blob: 10dcd8a819b9a3bd2a78731fddf30ea834ce9b9e (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
#!/bin/sh

# PROVIDE: immortaldir
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# immortaldir_enable (bool):    Set it to "YES" to enable immortaldir
#                               Default is "NO"
#
# immortaldir_path (str):       Set the directory that will be scanned
#                               Default is "/usr/local/etc/immortal"

. /etc/rc.subr

name=immortaldir
rcvar=immortaldir_enable

load_rc_config $name

: ${immortaldir_enable="NO"}
: ${immortaldir_path=%%PREFIX%%/etc/immortal}

command=%%PREFIX%%/bin/${name}
command_args=${immortaldir_path}
start_cmd=immortaldir_run

immortaldir_run()
{
        PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
        /usr/sbin/daemon -c /bin/sh -c "$command $immortaldir_path 2>&1 | logger -t immortaldir"
}

run_rc_command "$1"