Check-in [adf4eb9997]
Logged in as anonymous
Overview
Comment:fix binary selection, stop when no binary, add idprio/rtprio
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: adf4eb9997ae3d4ef56cb3ad16eed78519e9f7831fe00785d1d0953936447adb
User & Date: arcade on 2023-11-04 08:49:10.039
Other Links: manifest | tags
Context
2023-11-04
08:49
load pf module only once check-in: 202b534ed4 user: arcade tags: trunk
08:49
fix binary selection, stop when no binary, add idprio/rtprio check-in: adf4eb9997 user: arcade tags: trunk
08:48
fix tmpfs probing check-in: a0315ec3f2 user: arcade tags: trunk
Changes
16
17
18
19
20
21
22



23
24
25




26
27
28
29
30
31
32
33
34
35
36
37
DAEMON_example_FLAGS?=

# flags to prevent daemonizing
DAEMON_example_FOREGROUND?=

# group to run service as
DAEMON_example_GROUP?=wheel




# kernel modules to load prior to service start
DAEMON_example_MODULES?=





# user to run service as
DAEMON_example_USER?=root

# extra commands to execute before starting service
# ${_SERVICE} - starts after root mount appear
# ${_EARLYSERVICE} - not required on early boot
# you also can select specific starter by inheriting class by full name:
# ${_(EARLY)?SERVICE(_(SVC|DAEMON|PLAIN))?}

example: ${_EARLYSERVICE}
	: run commands that should go before the service start







>
>
>



>
>
>
>





|
|





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
DAEMON_example_FLAGS?=

# flags to prevent daemonizing
DAEMON_example_FOREGROUND?=

# group to run service as
DAEMON_example_GROUP?=wheel

# lower process priority by using `idprio`
DAEMON_example_IDPRIO?=

# kernel modules to load prior to service start
DAEMON_example_MODULES?=

# raise process priority by using `rtprio`
# (IDPRIO setting takes precedence if set)
DAEMON_example_RTPRIO?=

# user to run service as
DAEMON_example_USER?=root

# extra commands to execute before starting service
# ${_EARLYSERVICE} - starts after root mount appear
# ${_SERVICE} - not required on early boot
# you also can select specific starter by inheriting class by full name:
# ${_(EARLY)?SERVICE(_(SVC|DAEMON|PLAIN))?}

example: ${_EARLYSERVICE}
	: run commands that should go before the service start
1
2
3
4
5
6
7
8
9

10
11
12
13
14
15

16









17
18
19
20
21
22
23
OTHER_TARGETS+=_service_pre

STARTER?=svc

_service_check: .USEBEFORE
	# check whether service is enabled
	if [ -z "$${DAEMON_$@_ENABLE}" -a -z "${FORCE}" ]; then \
		exit 0 ;\
	fi ;\

	for CMD in ${DAEMON_$@_COMMAND}; do \
		if [ -x $${CMD} ]; then \
			export CMD ;\
			break ;\
		fi ;\
	done ;\

	echo $${CMD}










_service_pre: .USEBEFORE
	# kldload modules if any
	echo "MRC:$@> Starting service." ;\
	if [ -n "${DAEMON_$@_MODULES}" ]; then \
		kldload -n ${DAEMON_$@_MODULES}; \
	fi








|
>
|
|
|


|
>
|
>
>
>
>
>
>
>
>
>







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
OTHER_TARGETS+=_service_pre

STARTER?=svc

_service_check: .USEBEFORE
	# check whether service is enabled
	if [ -z "$${DAEMON_$@_ENABLE}" -a -z "${FORCE}" ]; then \
		exit 0 ;\
	fi
	# check for first present executable
	for COMMAND in ${DAEMON_$@_COMMAND}; do \
		if [ -x $${COMMAND} ]; then \
			export CMD="${COMMAND}" ;\
			break ;\
		fi ;\
	done
	# bail out if binary not found
	if [ -z $${CMD} ]; then \
		MRC:$@> Executable not found.
		exit 0 ;\
	fi
	# check for rtprio/idprio
	if [ -n "$${DAEMON_$@_IDPRIO}" ]; then \
		export CMD="/usr/sbin/idprio $${DAEMON_$@_IDPRIO} $${CMD}" ;\
	elif [ -n "$${DAEMON_$@_RTPRIO}" ]; then \
		export CMD="/usr/sbin/rtprio $${DAEMON_$@_RTPRIO} $${CMD}" ;\
	fi

_service_pre: .USEBEFORE
	# kldload modules if any
	echo "MRC:$@> Starting service." ;\
	if [ -n "${DAEMON_$@_MODULES}" ]; then \
		kldload -n ${DAEMON_$@_MODULES}; \
	fi