Re: Running a music player via cron
Hi, > >> Playing: http://direct.franceinfo.fr/live/franceinfo-midfi.mp3 > >> (+) Audio --aid=1 (mp3 1ch 44100Hz) > >> ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave > >> [ao/alsa] Playback open error: Device or resource busy > >> [ao/oss] Can't open audio device /dev/dsp: Device or resource busy > > > > Either another process is still acessing your speakers or may you're > > not logged in. > > I am logged in. I suspect a pulseauio issue. Me too. What does it say with -ao pulse ? I suspect $PULSE_SERVER is not set and mpv cannot find the server started in your graphical session. I would find its contents in my graphical session, put it in the crontab and if it works, come up with a script to guess it. Thanks, Alex
Re: Running a music player via cron
On Sat, Sep 28, 2019 at 07:13:32AM +0200, Jean-Philippe MENGUAL wrote: > > You might want to check by adding this part to your script (before the > > part "echo CTRL+C to..."): > > > > proc=`fuser /dev/dsp| awk "{print $2}"` > > if [ -n ${proc+x} ]; then > > ps auxww | awk '($2 == '$proc'){print $0}' > > else > > echo "no process is obtaining /dev/dsp" > > fi > > > > and it will print which process is obtaining the /dev/dsp > > hmmm I get: > awk: line 1: syntax error at or near ) Yeah, the quoting is rather messed up there. In fact, the whole command is rather suspect, for several reasons. Best to discard it. I believe the intent was to do something like this: if pids=$(fuser /dev/dsp 2>/dev/null); then echo "the following processes are using /dev/dsp:" for pid in $pids; do ps -o pid= -o args= -p "$pid" done else echo "no processes are using /dev/dsp" fi One may adjust the ps -o options as desired. (I wrote this for sh, not bash. Had I written it for bash, I would have used arrays and a dynamically generated single ps command, instead of an unquoted list-in-a-string and multiple ps commands.)
Re: Running a music player via cron
Hi, > >> setleds: Error reading current flags setting. Maybe you are not on the >> console?: ioctl KDGKBLED: Ioctl() inapproprié pour un périphérique > > Seems you're not logged in. > The "setleds +num" works only, if you're logged in, e.g. having a > window manager running. hmmm strange, as I am logged in. > >> Playing: http://direct.franceinfo.fr/live/franceinfo-midfi.mp3 >> (+) Audio --aid=1 (mp3 1ch 44100Hz) >> ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave >> [ao/alsa] Playback open error: Device or resource busy >> [ao/oss] Can't open audio device /dev/dsp: Device or resource busy > > Either another process is still acessing your speakers or may you're > not logged in. I am logged in. I suspect a pulseauio issue. > > You might want to check by adding this part to your script (before the > part "echo CTRL+C to..."): > > proc=`fuser /dev/dsp| awk "{print $2}"` > if [ -n ${proc+x} ]; then > ps auxww | awk '($2 == '$proc'){print $0}' > else > echo "no process is obtaining /dev/dsp" > fi > > and it will print which process is obtaining the /dev/dsp hmmm I get: awk: line 1: syntax error at or near ) I added the lines before: echo CTRL+C to exit && $S The up-to-date script: https://paste.debian.net/1102668/ Many thanks for your help Regards >> Cannot connect to server socket err = No such file or directory >> Cannot connect to server request channel >> jack server is not running or cannot be started >> JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, >> skipping unlock >> JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, >> skipping unlock >> [ao/jack] cannot open server >> ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave >> couldn't open play stream: Device or resource busy >> [ao/sndio] can't open sndio default >> [ao] Failed to initialize audio driver 'sndio' >> Could not open/initialize audio device -> no sound. >> Audio: no audio >> : 00:00:00 / 00:00:00 (0%) Cache: 0s >> >> >> Exiting... (Errors when loading file) >> TERM environment variable not set. > > again a "clear" > > Regards, > Klaus. >
Re: Running a music player via cron
To listen music under bash I always use cvlc from program vlc. Maybe a other possibility. Regards Am 25.09.2019 um 17:24 schrieb Jean-Philippe MENGUAL: Hello, Since some Sid update (about 2 weeks), something may have happent in te audio stack or the terminal because what worked no longer works. So I am under Sid, MATE desktop, via lightdm, pulseaudio, systemd, etc. Ont minor thing is that if I run an audio as a user or root at boot before login invia lightem, audio does not work, but well... Anyway, here I want to run mpv via a cron job under my regular user. The command works, but via cron, I get an audio access problem. The command: killall mpv;/home/jp/radio 10 100 The result: TERM environment variable not set. setleds: Error reading current flags setting. Maybe you are not on the console?: ioctl KDGKBLED: Ioctl() inapproprié pour un périphérique TERM environment variable not set. CTRL+C to exit Playing: http://direct.franceinfo.fr/live/franceinfo-midfi.mp3 (+) Audio --aid=1 (mp3 1ch 44100Hz) ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave [ao/alsa] Playback open error: Device or resource busy [ao/oss] Can't open audio device /dev/dsp: Device or resource busy Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock [ao/jack] cannot open server ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave couldn't open play stream: Device or resource busy [ao/sndio] can't open sndio default [ao] Failed to initialize audio driver 'sndio' Could not open/initialize audio device -> no sound. Audio: no audio : 00:00:00 / 00:00:00 (0%) Cache: 0s Exiting... (Errors when loading file) TERM environment variable not set. TERM environment variable not set. Same with: killall mpv;env DISPLAY=:0 /home/jp/radio 10 100 Here is the script: https://paste.debian.net/1102308/ Thanks for your help Regards
Re: Running a music player via cron
>> > > Are you running the command under the 'jp' user? Yes, it is the jp crontab. And it works if I run as jp manually. Best regards > > -- > John Doe >
Re: Running a music player via cron
On 9/25/2019 5:24 PM, Jean-Philippe MENGUAL wrote: > Hello, > > Since some Sid update (about 2 weeks), something may have happent in te > audio stack or the terminal because what worked no longer works. > > So I am under Sid, MATE desktop, via lightdm, pulseaudio, > systemd, etc. Ont minor thing is that if I run an audio as a user or > root at boot before login invia lightem, audio does not work, but well... > > Anyway, here I want to run mpv via a cron job under my regular user. The > command works, but via cron, I get an audio access problem. > > The command: > killall mpv;/home/jp/radio 10 100 > > The result: > > > TERM environment variable not set. > setleds: Error reading current flags setting. Maybe you are not on the > console?: ioctl KDGKBLED: Ioctl() inapproprié pour un périphérique > TERM environment variable not set. > CTRL+C to exit > Playing: http://direct.franceinfo.fr/live/franceinfo-midfi.mp3 > (+) Audio --aid=1 (mp3 1ch 44100Hz) > ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave > [ao/alsa] Playback open error: Device or resource busy > [ao/oss] Can't open audio device /dev/dsp: Device or resource busy > Cannot connect to server socket err = No such file or directory > Cannot connect to server request channel > jack server is not running or cannot be started > JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, > skipping unlock > JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, > skipping unlock > [ao/jack] cannot open server > ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave > couldn't open play stream: Device or resource busy > [ao/sndio] can't open sndio default > [ao] Failed to initialize audio driver 'sndio' > Could not open/initialize audio device -> no sound. > Audio: no audio > : 00:00:00 / 00:00:00 (0%) Cache: 0s > > > Exiting... (Errors when loading file) > TERM environment variable not set. > > > TERM environment variable not set. > > Same with: > killall mpv;env DISPLAY=:0 /home/jp/radio 10 100 > > Here is the script: > https://paste.debian.net/1102308/ > > Thanks for your help > > > Regards > > > > > > > > Are you running the command under the 'jp' user? -- John Doe
Running a music player via cron
Hello, Since some Sid update (about 2 weeks), something may have happent in te audio stack or the terminal because what worked no longer works. So I am under Sid, MATE desktop, via lightdm, pulseaudio, systemd, etc. Ont minor thing is that if I run an audio as a user or root at boot before login invia lightem, audio does not work, but well... Anyway, here I want to run mpv via a cron job under my regular user. The command works, but via cron, I get an audio access problem. The command: killall mpv;/home/jp/radio 10 100 The result: TERM environment variable not set. setleds: Error reading current flags setting. Maybe you are not on the console?: ioctl KDGKBLED: Ioctl() inapproprié pour un périphérique TERM environment variable not set. CTRL+C to exit Playing: http://direct.franceinfo.fr/live/franceinfo-midfi.mp3 (+) Audio --aid=1 (mp3 1ch 44100Hz) ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave [ao/alsa] Playback open error: Device or resource busy [ao/oss] Can't open audio device /dev/dsp: Device or resource busy Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock [ao/jack] cannot open server ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave couldn't open play stream: Device or resource busy [ao/sndio] can't open sndio default [ao] Failed to initialize audio driver 'sndio' Could not open/initialize audio device -> no sound. Audio: no audio : 00:00:00 / 00:00:00 (0%) Cache: 0s Exiting... (Errors when loading file) TERM environment variable not set. TERM environment variable not set. Same with: killall mpv;env DISPLAY=:0 /home/jp/radio 10 100 Here is the script: https://paste.debian.net/1102308/ Thanks for your help Regards -- Jean-Philippe MENGUAL