[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian 9 cron = sounds are ok : Debian 11 cron no sound



On 2022-07-16 at 04:47, Roger Price wrote:

> People occasionally have a cron job emit some sound each hour.  On my Debian 9 
> machine I hear Biff [1] barking. In /etc/crontab I have an entry to call a 
> script bark.sh which does the barking. Typically
> 
>   0,1 0,12 * * * rprice full-path-to/bark.sh 12 2>>&1
> 
> where bark.sh is a Bash script which calls /usr/bin/play to play a .au file.
> 
> This ran for years with Debian 9. I upgrade to Debian 11 and hear nothing.  The 
> usual advice is
>   (a) in /etc/crontab export XDG_RUNTIME_DIR=/run/user/1000
>   (b) play the sound from a script.
> 
> But that doesn't work with Debian 11. Does any reader of this list have sound 
> coming from a Debian 11 cron job?  If so, how is it done?

I don't use cron to play sounds, so I can't speak to this directly,
but...

While this may turn out in the end to be pure FUD, when I hear about
things which work properly when run by hand but not when run
automatically on a modern Debian system, my first suspicion is always
that the culprit is the systemd / logind / whatever-it-is "user session"
concept.

In this case, my guess would be that there's a session being set up when
you log in which puts in place the necessary configuration, access
permissions, or the like to make it possible for play to do what you
need it to do - but for a command invoked from the crontab, no such
session has been set up (or whatever session is set up doesn't supply
the same configuration), so play can't produce any audible output.

Another thing I don't do is run systemd, so I'm not in a position to
even figure out what you'd do to verify that, never mind test
possibilities for myself. Again, this might be a complete false trail
and nothing but unfounded FUD, but it *might* be worth checking out.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: