[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 7/17/22, The Wanderer  wrote:
> 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.

I don't know about systemd, but cron sets just a very few environment
vars (interestingly enough, you _do_ get /etc/environment processed).
I'd guess the problem with "works when run interactively but fails
when run from cron" is because most all of the sh setup is skipped for
things started by cron.

Lee


Reply to: