aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/noc/files/noc.sh.in
blob: dad6a3fc9c02aeae996678d2130ba06f4dc55cbc (plain) (blame)
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
49
50
51
52
53
54
55
56
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: noc
# REQUIRE: DAEMON %%RCLDCONFIG%%
# BEFORE: LOGIN
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable noc:
#  noc_enable (bool):    Set to "NO" by default.
#                       Set it to "YES" to enable noc.
#

. /etc/rc.subr

name="noc"
rcvar=noc_enable

# set defaults

load_rc_config $name

: ${noc_enable="NO"}
: ${noc_config="%%NOCDIR%%/etc/noc-launcher.conf"}
: ${noc_flags="-c ${noc_config}"}

export PATH=$PATH:%%PYTHONBASE%%/bin

noc_chdir=%%NOCDIR%%
command=%%NOCDIR%%/scripts/noc-launcher.py
command_interpreter=python
pidfile=%%LOCALSTATE_DIR%%/noc-launcher.pid
required_files=${noc_config}

command_args=$1

case "$command_args" in
    force*)
	command_args=${command_args#force};
	;;
    fast*)
	command_args=${command_args#fast};
	;;
    restart)
	command_args="stop"
	run_rc_command "stop"
	command_args="start"
	run_rc_command "start"
	exit 0
	;;
esac

run_rc_command "$1"