3

It does not matter which instruction related to sound I use. It seems that instruction is working, but I hear no sound. Crontab run on the same user and on root. No sound effect (process works in the back).

  1. espeak -ven "Hello" - typed in a terminal works, typed in a cron does not. In htop I see that espeak is working every minute.
  2. amixer -D pulse sset Master 10% - in a terminal works, typed in a cron does not.
  3. mpsyt .blablabla, 1 - in a terminal works, typed in a cron does not.
  4. Google Assistant started normally works. Started from cron does not (do not even hear me - so mic problem is also an issue).

Logs are empty except mpsyt log saying: "]2;mpsyt" whatever it means :).

Cronjobs not related to sound work perfectly. I made a script that writes to file and play a sound. File is fine. No sound at all.

I was always sure that running scripts from cron are equal to scripts run from terminal. So what causes the difference?

K.

3 Answers3

4

As per this answer: Can I use cron to chime at top of hour like a grandfather clock? you need to export an environment variable before playing sounds in your cron script:

export XDG_RUNTIME_DIR="/run/user/1000"
0

Thx for trying to help. I have just done a complete reinstall of Ubuntu 18.04 (too many issues without installation done with few upgrades).

K.

0

You may need to initialize sound in crontab temporary shell to get sound.

So you can initialize sound in crontab or at least in script that is called from crontab.

pbies
  • 204