commit e0f72bdadf52b45884053d8d21c2b909cdb9aced
parent b28e60b1863d6c69fab1f896617d8dc67ae055b1
Author: ccx <root@dorje.wpr.cz>
Date: Thu, 2 Sep 2021 18:32:39 +0200
Add cgroup support to longruns.
Diffstat:
14 files changed, 140 insertions(+), 0 deletions(-)
diff --git a/alsactl-rdaemon/run b/alsactl-rdaemon/run
@@ -1,2 +1,12 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/alsactl-rdaemon }
+ redirfd -w 1 /run/cgroup2/s6-rc/alsactl-rdaemon/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
alsactl rdaemon
diff --git a/dhcpcd/run b/dhcpcd/run
@@ -1,2 +1,12 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/dhcpcd }
+ redirfd -w 1 /run/cgroup2/s6-rc/dhcpcd/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
dhcpcd --nobackground
diff --git a/sshd/run b/sshd/run
@@ -1,3 +1,13 @@
#!/command/execlineb -P
fdmove -c 2 1
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/sshd }
+ redirfd -w 1 /run/cgroup2/s6-rc/sshd/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
/usr/sbin/sshd -D -f /etc/ssh/sshd_config
diff --git a/svscan-ccx-log/run b/svscan-ccx-log/run
@@ -1,4 +1,14 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/svscan-ccx-log }
+ redirfd -w 1 /run/cgroup2/s6-rc/svscan-ccx-log/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
if { mkdir -p /run/user/ccx.logs }
if { chown ccx: /run/user/ccx.logs }
if { chmod 700 /run/user/ccx.logs }
diff --git a/svscan-ccx/run b/svscan-ccx/run
@@ -1,4 +1,14 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/svscan-ccx }
+ redirfd -w 1 /run/cgroup2/s6-rc/svscan-ccx/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
if { mkdir -p /run/user/ccx }
if { chown ccx: /run/user/ccx }
if { chmod 700 /run/user/ccx }
diff --git a/syncthing-log/run b/syncthing-log/run
@@ -1,3 +1,13 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/syncthing-log }
+ redirfd -w 1 /run/cgroup2/s6-rc/syncthing-log/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
if { mkdir -p /var/log/syncthing }
s6-log -b -- n10 s10240000 t /var/log/syncthing
diff --git a/syncthing/run b/syncthing/run
@@ -1,4 +1,14 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/syncthing }
+ redirfd -w 1 /run/cgroup2/s6-rc/syncthing/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
/usr/bin/env HOME=/var/lib/syncthing
s6-setuidgid syncthing
syncthing -logflags 0
diff --git a/tty1/run b/tty1/run
@@ -1,2 +1,12 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/tty1 }
+ redirfd -w 1 /run/cgroup2/s6-rc/tty1/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
/usr/bin/env LOGIN_TTY=/dev/tty1 /sbin/getty -l /usr/local/bin/login-keepenv 38400 tty1 linux
diff --git a/tty2/run b/tty2/run
@@ -1,2 +1,12 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/tty2 }
+ redirfd -w 1 /run/cgroup2/s6-rc/tty2/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
/usr/bin/env LOGIN_TTY=/dev/tty2 /sbin/getty -l /usr/local/bin/login-keepenv 38400 tty2 linux
diff --git a/tty3/run b/tty3/run
@@ -1,2 +1,12 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/tty3 }
+ redirfd -w 1 /run/cgroup2/s6-rc/tty3/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
/usr/bin/env LOGIN_TTY=/dev/tty3 /sbin/getty -l /usr/local/bin/login-keepenv 38400 tty3 linux
diff --git a/tty4/run b/tty4/run
@@ -1,2 +1,12 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/tty4 }
+ redirfd -w 1 /run/cgroup2/s6-rc/tty4/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
/usr/bin/env LOGIN_TTY=/dev/tty4 /sbin/getty -l /usr/local/bin/login-keepenv 38400 tty4 linux
diff --git a/udev/run b/udev/run
@@ -1,4 +1,14 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/udev }
+ redirfd -w 1 /run/cgroup2/s6-rc/udev/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
background {
sh -xc "until /sbin/udevadm settle --timeout=120; do sleep 0.5; done; echo >&3 settled"
#foreground { loopwhilex -x 0 if -nt { /sbin/udevadm settle --timeout=120 } foreground { sleep 0.1 } exit 1 }
diff --git a/unbound/run b/unbound/run
@@ -1,2 +1,12 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/unbound }
+ redirfd -w 1 /run/cgroup2/s6-rc/unbound/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
unbound -d
diff --git a/wpa_supplicant/run b/wpa_supplicant/run
@@ -1,4 +1,14 @@
#!/command/execlineb -P
+getpid SERVICE_PID
+foreground {
+ importas -i SERVICE_PID SERVICE_PID
+ if { test -d /run/cgroup2 }
+ if { mkdir -p /run/cgroup2/s6-rc/wpa_supplicant }
+ redirfd -w 1 /run/cgroup2/s6-rc/wpa_supplicant/cgroup.procs
+ printf "%s" ${SERVICE_PID}
+}
+unexport SERVICE_PID
+
/sbin/wpa_supplicant
-iwlan0
-c/etc/wpa_supplicant/wpa_supplicant.conf