0

Recently, after performing the routine update in my Ubuntu system (19.10), the command /usr/bin/play cannot play from Cron anymore (works fine on the command line). It was working great before for long time.

My script (which is called periodically by cron):

#! /bin/bash
...
/usr/bin/play <path-to-soundfile> 2> /tmp/log.txt
...

I get the error

ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
/usr/bin/play FAIL sox: Sorry, there is no default audio device configured

I tried other players like mplayer, aplay and cvlc, but no luck. After doing some research about the issue, I tried these lines at the beginning of my bash script:

XDG_RUNTIME_DIR=/run/user/<userid>
export DISPLAY=:0
export XAUTHORITY=/home/<username>/.Xauthority

but to no avail.

Also, I added my user to the audio group. Still no change.

Any ideas?

1 Answer 1

1

not sure what will help, but ...

step 1

xuser@mbs:~$ env|grep -i runt
XDG_RUNTIME_DIR=/run/user/1000

step 2 create file play.sh (remember about chmod)

#!/bin/bash
export XDG_RUNTIME_DIR=/run/user/1000
/usr/bin/mpg123 $1

step 3 crontab -e

хх * * * * /home/xuser/bin/play.sh /home/xuser/Музыка/demo_moya_vesna.mp3

step 4

$%)) ata-ta %:) enjoy
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .