You are not logged in.

#1 2016-06-06 19:56:10

cocosushi
Member
Registered: 2016-06-06
Posts: 2

[SOLVED] Cron and systemd timers gives no sound mplayer

Hi everybody,

I am new to archlinux (installed it two weeks ago) and I'm trying to do a bit more exploration than I did on ubuntu.
I am currently trying to create a little alarm clock that plays an mp3 song using cron and mplayer, but I am stuck at the moment, because the cron, when executed, produces no sound.

Here is the command in my crontab (I use cronie) :

 42 21 * * * env; /usr/bin/mplayer /home/user/Music/some_piece.mp3 

I have tried the command mplayer independently, and it works perfectly. I also checked the cron was launched in journactl, and, apart from the message telling me the cron was launched, there was also some error messages :

 Jun 06 17:39:01 random-host-arch CROND[2901]: (sacha) CMDOUT ([AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT ([AO_ALSA] alsa-lib: pcm_hw.c:1590:(snd_pcm_hw_open) open '/dev/snd/pcmC0D0p' failed (-2): No such file or directory)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT ([AO_ALSA] alsa-lib: pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT ([AO_ALSA] Playback open error: No such file or directory)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT (AO: [pulse] Init failed: Connection refused)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT (connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory))
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT (attempt to connect to server failed)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT ([JACK] cannot open server)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT ([AO SDL] Samplerate: 48000Hz Channels: Stereo Format s16le)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT ([AO_ALSA] alsa-lib: pcm_hw.c:1590:(snd_pcm_hw_open) open '/dev/snd/pcmC0D0p' failed (-2): No such file or directory)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT ([AO_ALSA] alsa-lib: pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave)
Jun 06 17:39:01 random-host-arch CROND[2901]: (user) CMDOUT ([AO SDL] Unable to open audio: No available audio device)

As I'm not very familiar with ALSA and Pulse, I don't understand these messages very well.

Could you please help me resolving that problem ?

Thanks smile

PS : sorry for the bad english, it's not my native language.

Last edited by cocosushi (2016-07-02 15:54:16)

Offline

#2 2016-07-02 15:48:00

cocosushi
Member
Registered: 2016-06-06
Posts: 2

Re: [SOLVED] Cron and systemd timers gives no sound mplayer

So, I finally managed to solve my issue, in a quite dirty way ^^
I switched player, I now use cvlc, the command line vlc, and set its default sound output not to pulseaudio, but to alsa (not the default, which is "Pulseaudio sound server" too). The cron works very well like that, even though I can't play an other sound while my alarmclock is running, but that's fine.

Offline

Board footer

Powered by FluxBB