Hi,
Hoping this is the right place to ask for some help as I am very new to s6 and not well versed on any init system.
I’m attempting to use what I understand to be the “new” s6-rc way to start some processes in a docker container.
Just for testing out what I want to do, I have a oneshot who’s job is just to sleep, and a longrun that depends on the oneshot.
I have created the following files
[Aug 19 18:42:24 root_at_s6 ~]# ll /etc/s6-overlay/s6-rc.d/longrun_test/
total 12
-rw-rw-r-- 1 root root 13 Aug 17 23:19 dependencies
-rw-rw-r-- 1 root root 53 Aug 19 18:29 run
-rw-rw-r-- 1 root root 8 Aug 17 23:19 type
[Aug 19 18:42:24 root_at_s6 ~]# cat /etc/s6-overlay/s6-rc.d/longrun_test/type
longrun
[Aug 19 18:42:24 root_at_s6 ~]# cat /etc/s6-overlay/s6-rc.d/longrun_test/run
#!/command/execlineb -P
/usr/local/bin/longrun_start
[Aug 19 18:42:24 root_at_s6 ~]# cat /etc/s6-overlay/s6-rc.d/longrun_test/dependencies
sleeponstart
[Aug 19 18:42:24 root_at_s6 ~]# ll /etc/s6-overlay/s6-rc.d/sleeponstart/
total 8
-rw-rw-r-- 1 root root 8 Aug 15 21:53 type
-rw-rw-r-- 1 root root 52 Aug 16 20:25 up
[Aug 19 18:42:24 root_at_s6 ~]# cat /etc/s6-overlay/s6-rc.d/sleeponstart/type
oneshot
[Aug 19 18:42:24 root_at_s6 ~]# cat /etc/s6-overlay/s6-rc.d/sleeponstart/up
#!/command/execlineb -P
/usr/local/bin/sleeponstart
I can see that my services are registered with s6-rc
[Aug 19 18:43:04 root_at_s6 ~]# s6-rc-db list all | grep -e longrun_test -e sleeponstart
sleeponstart
longrun_test
The test services are very simple scripts just to prove they ran
[Aug 19 18:44:23 root_at_s6 ~]# cat /usr/local/bin/sleeponstart
#!/bin/bash
sleep_time=30
sleep ${sleep_time}
echo "I slept for ${sleep_time}." > /tmp/i_slept
[Aug 19 18:44:23 root_at_s6 ~]# cat /usr/local/bin/longrun_start
#!/bin/bash
echo "I started the longrun" > /tmp/longrun_started
But when I look in tmp I never see the files created.
[Aug 19 18:44:23 root_at_s6 ~]# ll /tmp/
total 652
-rw------- 1 root root 5516 Mar 7 20:55 s6-overlay-noarch.tar.xz
-rw------- 1 root root 656864 Mar 7 20:55 s6-overlay-x86_64.tar.xz
If I start the longrun manually it and its dependency do run.
[Aug 19 18:50:00 root_at_s6 ~]# s6-rc -a change longrun_test
[Aug 19 18:52:08 root_at_s6 ~]# ll /tmp/
total 660
-rw-r--r-- 1 root root 16 Aug 19 18:50 i_slept
-rw-r--r-- 1 root root 22 Aug 19 18:52 longrun_started
-rw------- 1 root root 5516 Mar 7 20:55 s6-overlay-noarch.tar.xz
-rw------- 1 root root 656864 Mar 7 20:55 s6-overlay-x86_64.tar.xz
So I would normally just think I am missing something to make them start on boot BUT, soon after boot I do see my oneshot running.
[Aug 19 18:53:54 root_at_s6 /]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.5 0.0 200 64 ? Ss 18:53 0:00 /package/admin/s6/command/s6-svscan -d4 -- /run/service
root 14 0.0 0.0 4152 3104 pts/0 Ss+ 18:53 0:00 /bin/sh -e /run/s6/basedir/scripts/rc.init top
root 15 0.0 0.0 204 64 ? S 18:53 0:00 s6-supervise s6-linux-init-shutdownd
root 16 0.0 0.0 196 4 ? Ss 18:53 0:00 /package/admin/s6-linux-init/command/s6-linux-init-shutdownd -c /run/s6/basedir -g 3000 -C -B
root 23 0.0 0.0 204 68 ? S 18:53 0:00 s6-supervise s6rc-oneshot-runner
root 24 0.0 0.0 204 64 ? S 18:53 0:00 s6-supervise longrun_test
root 25 0.0 0.0 204 60 ? S 18:53 0:00 s6-supervise s6rc-fdholder
root 28 0.0 0.0 208 64 pts/0 S+ 18:53 0:00 s6-rc -v2 -u -t 5000 -- change top
root 32 0.0 0.0 180 4 ? Ss 18:53 0:00 /package/admin/s6/command/s6-ipcserverd -1 -- /package/admin/s6/command/s6-ipcserver-access -v0 -E -l0 -i data/rules
root 34 0.0 0.0 192 52 pts/0 S+ 18:53 0:00 /package/admin/s6-2.11.1.0/command/s6-sudoc -e -t 30000 -T 4999 -- up 3
root 36 0.0 0.0 200 60 ? S 18:53 0:00 /package/admin/s6/command/s6-sudod -t 30000 -- /package/admin/s6-rc/command/s6-rc-oneshot-run -l ../.. --
root 38 0.0 0.0 4152 3080 ? S 18:53 0:00 /bin/bash /usr/local/bin/sleeponstart <--------------
root 40 0.0 0.0 2616 940 ? S 18:53 0:00 sleep 30 <-----------------
root 53 1.0 0.0 4812 3836 pts/1 Ss 18:53 0:00 /bin/bash
root 74 0.0 0.0 7396 3268 pts/1 R+ 18:53 0:00 ps aux
Sorry if this was much more info than was relevant. Any help would be great. Thanx so much!
-Benjamin
Received on Sat Aug 20 2022 - 13:01:11 CEST