Home
Timeline
Files
Branches
Tags
Tickets
Logout
...
Overview
Context
Changes
1
2
3
4
1
2
3
4
5
-
+
+
DAEMON_boinc-client_COMMAND?=/usr/local/bin/boinc_client
DAEMON_boinc-client_FLAGS?=--redirectio --dir /var/db/boinc
DAEMON_boinc-client_FLAGS?=--redirectio --dir /var/db/boinc
DAEMON_boinc-client_BACKGROUND?=-daemon
DAEMON_boinc-client_ENABLE?=no
DAEMON_boinc-client_USER?=boinc
1
2
3
4
5
6
1
2
3
4
5
6
-
-
-
+
+
+
-
-
+
+
DAEMON_bsdstats_COMMAND?=/usr/local/etc/periodic/monthly/300.statistics
DAEMON_bsdstats_ENABLE?=no
DAEMON_bsdstats_FLAGS?=-nodelay
DAEMON_bsdstat_COMMAND?=/usr/local/etc/periodic/monthly/300.statistics
DAEMON_bsdstat_ENABLE?=no
DAEMON_bsdstat_FLAGS?=-nodelay
bsdstats: _service_plain
bsdstats_exit:
bsdstat: ${ _SERVICE _PLAIN}
bsdstat_exit:
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
-
+
_service_daemon: .USE
daemon -c -u ${DAEMON_$@_USER:Uroot} -r -P /var/run/daemon.$@.pid ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON$@_FOREGROUND}
_service_daemon_status: .USE
echo "Not supported yet."
_service_daemon_exit: .USEBEFORE
kill -TERM /var/run/daemon.$@.pid
kill -TERM /var/run/daemon.${@:S/_exit//} .pid
︙
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-
-
+
+
-
-
-
+
-
-
-
-
+
+
# 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
# _earlyservice - starts after root mount appear
# _service - doesn't required for early boot
# ${ _SERVICE} - starts after root mount appear
# ${ _EARLYSERVICE} - no t required on early boot
# you also can select specific starter by inheriting class by full name:
# _(daemon|plain|svc)_(early)?service
example: _earlyservice
test -n "$${DAEMON_$@_ENABLE}" || echo service is always execute
# ${_(EARLY)?SERVICE(_(SVC| DAEMON|PLAI N))?}
# you can't be sure whether service is enabled on the first run, when future
# targets are only assembled, as service can be enabled later in the chain
# somake sure to check whether service is enabled in scripts you are running
# not in make constructs
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
1
2
3
4
5
6
7
8
9
10
11
12
13
-
-
DAEMON_nfsd_COMMAND?=/sbin/nfsd
DAEMON_nfsd_ENABLE?=no
DAEMON_nfsd_FLAGS?=-u -t -n 4
.if empty(DAEMON_nfsd_ENABLE:tl:Mno)
DAEMON_rpcbind_ENABLE=yes
DAEMON_mountd_ENABLE=yes
.endif
nfsd: mountd ${_SERVICE} rpcbind
.if empty(NFS_RESERVED_PORT_ONLY:tl:Mno)
sysctl vfs.nfs.nfs_privport=1
.endif
nfsd_exit:
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
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
-
+
-
+
+
+
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
OTHER_TARGETS+=_service_pre
STARTER?=svc
_service_pre: .USEBEFORE
_service_check : .USEBEFORE
# check whether service is enabled
if [ -z "$${DAEMON_$@_ENABLE}" ]; then \
exit 0; \
fi; \
fi
_service_pre: .USEBEFORE
echo "MRC:$@> Starting service."
# kldload modules if any
if [ -n "${DAEMON_$@_MODULES}" ]; then \
kldload -n ${DAEMON_$@_MODULES}; \
fi; \
fi
_service_post_exit: .USE
echo "MRC:${@:S/_exit//}> stopped."
.for starter_source in ${:!find /etc/mrc -name '*.starter.mk'!:S/\/etc\/mrc\///}
starter:=${starter_source:S/.starter.mk$//}
Starter:=${starter:tu}
OTHER_TARGETS:=${OTHER_TARGETS} _service_${starter} _service_${starter}_exit _service_${starter}_status
_SERVICE_${Starter}:=_service_pre DAEMON _service_${starter}
_EARLYSERVICE_${Starter}:=_service_pre SERVICE _service_${starter}
_SERVICE_${Starter}_EXIT:=_service_${starter}_exit
_SERVICE_${Starter}:=_service_pre DAEMON _service_${starter} _service_check
_EARLYSERVICE_${Starter}:=_service_pre SERVICE _service_${starter} _service_check
_SERVICE_${Starter}_EXIT:=_service_${starter}_exit _service_post_exit
.if "${STARTER}" == "${starter}"
_SERVICE:=_service_pre DAEMON _service_${starter}
_EARLYSERVICE:=_service_pre SERVICE _service_${starter}
_SERVICE_EXIT:=_service_${starter}_exit
_SERVICE:=_service_pre DAEMON _service_${starter} _service_check
_EARLYSERVICE:=_service_pre SERVICE _service_${starter} _service_check
_SERVICE_EXIT:=_service_${starter}_exit _service_post_exit
.endif
.export
.include "${starter_source}"
.endfor
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
10
-
+
-
+
+
-
+
_service_svc: .USE
svc list $@ | grep -q $@ || \
svc -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} ${DAEMON_$@_RESTART:D-r} ${DAEMON_$@_RESTART} init $@ ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON_$@_FOREGROUND}
svc -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} ${DAEMON_$@_RESTART:D-r} ${DAEMON_$@_RESTART} init $@ ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON_$@_FOREGROUND}
_service_svc_status: .USE
svc status $@
svc status ${@:S/_status//}
_service_svc_exit: .USEBEFORE
svc list ${@:S/_exit//} | grep -q ${@:S/_exit//} || true && \
svc exit $@
svc -s exit ${@:S/_exit//}