aboutsummaryrefslogtreecommitdiffstats
path: root/community/containerd/containerd.initd
blob: e5758713620142e801d44cad56b5a435ccc07f15 (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
37
38
39
40
41
42
43
44
45
46
#!/sbin/openrc-run
supervisor=supervise-daemon

name="Container Daemon"
description="Standalone containerd (usually started by Docker)"

extra_started_commands="reload"
description_reload="Reload configuration without exiting"

command="${containerd_command:-/usr/bin/containerd}"
command_args="${containerd_opts}"
rc_ulimit="${ulimit_opts:--c unlimited -n 1048576 -u unlimited}"
retry="${signal_retry:-TERM/60/KILL/10}"

log_file="${log_file:-/var/log/${RC_SVCNAME}.log}"
err_file="${err_file:-${log_file}}"
log_mode="${log_mode:-0644}"
log_owner="${log_owner:-root:root}"

if [ "$log_file" = "$err_file" ]; then
	LOGPROXY_OPTS="$LOGPROXY_OPTS -m"
fi
export \
	LOGPROXY_CHMOD="$log_mode" \
	LOGPROXY_LOG_DIRECTORY="${LOGPROXY_LOG_DIRECTORY:-/var/log}" \
	LOGPROXY_ROTATION_SIZE="${LOGPROXY_ROTATION_SIZE:-104857600}" \
	LOGPROXY_ROTATION_TIME="${LOGPROXY_ROTATION_TIME:-86400}" \
	LOGPROXY_ROTATION_SUFFIX="${LOGPROXY_ROTATION_SUFFIX:-.%Y%m%d%H%M%S}" \
	LOGPROXY_ROTATED_FILES="${LOGPROXY_ROTATE_FILES:-5}"

output_logger="log_proxy $LOGPROXY_OPTS $log_file"
error_logger="log_proxy $LOGPROXY_OPTS $err_file"

depend() {
	need sysfs cgroups
}

start_pre() {
	checkpath -f -m "$log_mode" -o "$log_owner" "$log_file" "$err_file"
}

reload() {
	ebegin "Reloading configuration"
	$supervisor $RC_SVCNAME --signal HUP
	eend $?
}