Working on sxmo_alarm.sh, I noticed, since I upgraded to 1.8.0, that when I set the volume from a cron task (busybox's crond) the, my system hangs, creating thousands of processes. I could see in htop this process tree (sorry, it's an image, that's all I could get while the phone freezes): https://i.imgur.com/SbdSct8.png
To reproduce, add this in your crontab and wait for the task to run (BEWARE: a hard reboot is the only way out):
58 16 * * * /usr/bin/sxmo_audio.sh vol get > /tmp/cronvol
Note that in my screenshot, we don't see the original process, I killed it, but the fork bomb was re-parented to init.
I thought this would split a ton of logs, but it didn't:
10 18 * * * sh -c "set -x; /usr/bin/sxmo_audio.sh vol get 2>&1 | tee /home/user/forklog"
I got only one line:
/usr/bin/sxmo_audio.sh: line 142: can't create /sxmo.audiocurrentdevice: Permission denied
XDG_RUNTIME_DIR
is missing (maybe we shouldset -u
wherever possible)?EDIT, sourcing
/etc/profile.d/sxmo_init.sh
seems to fix the issue altogether18 18 * * * sh -c "set -x; . /etc/profile.d/sxmo_init.sh && /usr/bin/sxmo_audio.sh vol get 2>&1 | tee /home/user/forklog"
$ cat forklog 74
We should require that sxmo_init.sh is sourced at a bunch of strategic points.
You shouldnt set or get the volume from cron jobs anyway. Things that need a dbus session as pipewire or pulseaudio would fail without it.
You should probably load sxmo_init.sh before running the sxmo_audio.sh in your cronjob line.
(sorry if unrelated to the initial topic of the thread)
if XDG_RUNTIME_DIR is missing via ssh, after a recent upgrade, try to apk del elogind...