Hi,
Using 'crontab -e' I set crond to play an ogg music file with ogg123. But it only plays it if I'm logged in. How does one make it play even if a different user is logged in or nobody is logged in?
To debug I tried su - to another user and play the file. I got error
ALSA lib pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Connection refused
=== Could not load default driver and no driver specified in config file. Exiting.
So I'm thinking it's the same infrastructure to prevent others music playing when you switch users. But in my case I *want* it to play. Any ideas?
Thanks
On Sat, 2010-07-24 at 12:55 -0700, Robert Arkiletian wrote:
So I'm thinking it's the same infrastructure to prevent others music playing when you switch users. But in my case I *want* it to play. Any ideas?
/etc/security/console.perms.d/50-default.perms
On Sat, Jul 24, 2010 at 1:51 PM, Frank Cox theatre@sasktel.net wrote:
On Sat, 2010-07-24 at 12:55 -0700, Robert Arkiletian wrote:
So I'm thinking it's the same infrastructure to prevent others music playing when you switch users. But in my case I *want* it to play. Any ideas?
/etc/security/console.perms.d/50-default.perms
I created a new perms file called 51-default.perms and added
## <sound>=/dev/snd/* /dev/snd <console> 0666 <sound> 0666 root ##
rebooted (Did I need to?)
I now notice that the devices in /dev/snd are crw-rw-rw-+. So Others should be able to write to the device. But I still cannot get cron to play an ogg music file unless it's for the person currently logged in.
I have checked that the file plays fine when normally played so it's not an issue with ogg123 or the music file. Here is my crontab line (as tried for root)
30 12 * * 1 /usr/bin/ogg123 /root/Mists_of_Time-4T.ogg
/var/log/cron tells me the command is issued but no sound from speakers.
Here's the funny part. If I ssh in (as a different user) and run ogg123 from command line, sound plays on the sshd server machine. It works!! But not if I set it to play using cron. So basically one must be logged in either at the machine or through ssh.
Also, if nobody is logged in, nothing is heard. But as soon as I log into the user who has the cron job running, the sound comes on immediately at login. If I then log out while the song is playing, sound stops. Log back in and sound comes on again. Obviously, the ogg123 process is running but the sound is being disconnected unless the user is logged in.
wondering if udev rules is somehow responsible. Here is
/etc/udev/rules.d/90-alsa.rules
ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", \ RUN+="/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main restore /dev/$name" ACTION=="remove", SUBSYSTEM=="sound", KERNEL=="controlC*", \ RUN+="/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf store /dev/$name"
Any ideas much appreciated?
On Mon, 2010-07-26 at 12:59 -0700, Robert Arkiletian wrote:
Any ideas much appreciated?
Looks like you have the authorization for the sound device sorted out; there may also be something you have to do to tell pulseaudio to play sound for a user who is not currently logged in.
I don't know enough about pulseaudio to guide you there; perhaps a google search for something like "pulseaudio user authentication" or "pulseaudio user authorization" will be of value?
On Mon, Jul 26, 2010 at 1:35 PM, Frank Cox theatre@sasktel.net wrote:
On Mon, 2010-07-26 at 12:59 -0700, Robert Arkiletian wrote:
Any ideas much appreciated?
Looks like you have the authorization for the sound device sorted out; there may also be something you have to do to tell pulseaudio to play sound for a user who is not currently logged in.
I don't know enough about pulseaudio to guide you there; perhaps a google search for something like "pulseaudio user authentication" or "pulseaudio user authorization" will be of value?
Solved:
I simply removed pulseaudio and it works fine now. (on F11)
#yum remove pulseaudio alsa-plugins-pulseaudio
I must say, I find it kind of Windows-Like of Pulseaudio to force users to be logged in for audio to work. I think ALSA works just fine.
On 07/30/2010 12:44 PM, Robert Arkiletian wrote:
On Mon, Jul 26, 2010 at 1:35 PM, Frank Coxtheatre@sasktel.net wrote:
On Mon, 2010-07-26 at 12:59 -0700, Robert Arkiletian wrote:
Any ideas much appreciated?
Looks like you have the authorization for the sound device sorted out; there may also be something you have to do to tell pulseaudio to play sound for a user who is not currently logged in.
I don't know enough about pulseaudio to guide you there; perhaps a google search for something like "pulseaudio user authentication" or "pulseaudio user authorization" will be of value?
Solved:
I simply removed pulseaudio and it works fine now. (on F11)
#yum remove pulseaudio alsa-plugins-pulseaudio
I must say, I find it kind of Windows-Like of Pulseaudio to force users to be logged in for audio to work. I think ALSA works just fine.
in all fairness, PA has been working fine for me...
jack craig wrote:
On 07/30/2010 12:44 PM, Robert Arkiletian wrote:
On Mon, Jul 26, 2010 at 1:35 PM, Frank Coxtheatre@sasktel.net wrote:
On Mon, 2010-07-26 at 12:59 -0700, Robert Arkiletian wrote:
Any ideas much appreciated?
Looks like you have the authorization for the sound device sorted out; there may also be something you have to do to tell pulseaudio to play sound for a user who is not currently logged in.
I don't know enough about pulseaudio to guide you there; perhaps a google search for something like "pulseaudio user authentication" or "pulseaudio user authorization" will be of value?
Solved:
I simply removed pulseaudio and it works fine now. (on F11)
#yum remove pulseaudio alsa-plugins-pulseaudio
I must say, I find it kind of Windows-Like of Pulseaudio to force users to be logged in for audio to work. I think ALSA works just fine.
in all fairness, PA has been working fine for me...
Meaning that you are logged in all the time, of course.
On 07/26/2010 12:59 PM, Robert Arkiletian wrote:
On Sat, Jul 24, 2010 at 1:51 PM, Frank Coxtheatre@sasktel.net wrote:
On Sat, 2010-07-24 at 12:55 -0700, Robert Arkiletian wrote:
So I'm thinking it's the same infrastructure to prevent others music playing when you switch users. But in my case I *want* it to play. Any ideas?
/etc/security/console.perms.d/50-default.perms
I created a new perms file called 51-default.perms and added
## <sound>=/dev/snd/* /dev/snd <console> 0666<sound> 0666 root ##
rebooted (Did I need to?)
I now notice that the devices in /dev/snd are crw-rw-rw-+. So Others should be able to write to the device. But I still cannot get cron to play an ogg music file unless it's for the person currently logged in.
I have checked that the file plays fine when normally played so it's not an issue with ogg123 or the music file. Here is my crontab line (as tried for root)
30 12 * * 1 /usr/bin/ogg123 /root/Mists_of_Time-4T.ogg
/var/log/cron tells me the command is issued but no sound from speakers.
Here's the funny part. If I ssh in (as a different user) and run ogg123 from command line, sound plays on the sshd server machine. It works!! But not if I set it to play using cron. So basically one must be logged in either at the machine or through ssh.
Also, if nobody is logged in, nothing is heard. But as soon as I log into the user who has the cron job running, the sound comes on immediately at login. If I then log out while the song is playing, sound stops. Log back in and sound comes on again. Obviously, the ogg123 process is running but the sound is being disconnected unless the user is logged in.
wondering if udev rules is somehow responsible. Here is
/etc/udev/rules.d/90-alsa.rules
ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", \ RUN+="/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main restore /dev/$name" ACTION=="remove", SUBSYSTEM=="sound", KERNEL=="controlC*", \ RUN+="/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf store /dev/$name"
Any ideas much appreciated?
i am using crontab to do an alarm clock and it works fine. you said that you checked a nomral execuiton of the ogg player, but!
maybe in hte crontab ckey paths (known to your shell, but not default in crontab) are missing.
my example, ...
/MAILTO=jackc@linuxlighthouse.com PATH=$PATH:/bin:/usr/bin:/usr/sbin:/usr/local/bin
# Wakeup call ## disabled until needed again 30 6 * * 1,2,3,4,5 /home/jackc/bin/wakeup
you might add the mailto and see if it mails you any unresolved externals msg?
just a wag...
good luck... /
Robert Arkiletian wrote: <snip>
Any ideas?
'info nohup'?
On 24Jul2010 12:55, Robert Arkiletian robark@gmail.com wrote: | Using 'crontab -e' I set crond to play an ogg music file with ogg123. | But it only plays it if I'm logged in. | How does one make it play even if a different user is logged in or | nobody is logged in?
Can you show us exactly what command you used?
A lot of desktops change the file permissions of "core"/"console" devices at login to make them owned by the logged in user, so that other people remotely (or cronly) using the machine can't muck about with their desktop. (And their sound.)
| To debug I tried su - to another user and play the file. I got error
Try "su -" to be root, not another non-root user. Would be interesting to see what happens.
| ALSA lib pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: | Connection refused
Maybe opening a unix socket it doesn't own?
strace -f -e trace=file 2>/tmp/str.out ogg123 ...ogg-args...
then look at str.out. It will show you exactly what devices/files it tries to open and whether the opens work.
| === Could not load default driver and no driver specified in config | file. Exiting.
Probably a side effect of the failed open - this isn't lack of drivers, it is lack of access.
| So I'm thinking it's the same infrastructure to prevent others music | playing when you switch users.
Yes.
| But in my case I *want* it to play. Any | ideas?
Sudo? Grant your user the right to use ogg123 as root without a password and without needing a terminal (because it's happening from cron).
Might I suggest the "at" command instead of cron? The same access issues will apply but you can more easily queue commands for arbitrary times.
Cheers,
On 07/24/2010 02:55 PM, Robert Arkiletian wrote:
Hi,
Using 'crontab -e' I set crond to play an ogg music file with ogg123. But it only plays it if I'm logged in. How does one make it play even if a different user is logged in or nobody is logged in?
To debug I tried su - to another user and play the file. I got error
ALSA lib pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Connection refused
=== Could not load default driver and no driver specified in config file. Exiting.
So I'm thinking it's the same infrastructure to prevent others music playing when you switch users. But in my case I *want* it to play. Any ideas?
Ideas, yes. Solutions, no. Pulse Audio still confuses me. I'm almost afraid to comment. Give me courage.
I am guessing, but think the Pulse Audio Daemon is normally per user.
When a different user is logged in, that user starts Pulse Audio. Your cron job won't talk to the other user's Pulse Audio Daemon. Your cron job doesn't have the correct "cookie".
Your cron job won't be able to start a working Pulse Audio Daemon. The other user's Pulse Audio Daemon has the hardware.
Please, someone who understands this better, tell me if I'm correct.
If the above is the problem, there are, perhaps three ways to fix this. Two ways, are similar to Pulse Audio problems described in the FAQ.
People wanted to know how to make sound work when "switching users". In Linux, we have a "User Switch Applet" letting us switch users. http://www.pulseaudio.org/wiki/FAQ#Sounddoesntworkwhenswitchingusers The above suggests using ConsoleKit. I am guessing ConsoleKit defines "cookies" for sharing resources. If a user has the "cookie", that user can use the resource. I don't understand how to use ConsoleKit "cookies" with Pulse Audio. The "cookie" must be somewhere in the user's home directory.
People wanted to know how to configure Pulse Audio for over the network. The idea would be to have your cron job talk to the user's Pulse Audio as if your cron job audio were coming over the network. http://www.pulseaudio.org/wiki/FAQ#HowdoIusePulseAudiooverthenetwork I don't fully understand this choice either. I think, "copy ~/.pulse-cookie to all clients that shall be allowed to connect" may be necessary, but not sufficient.
Another choice is to run the Pulse Audio Daemon in "system mode". http://www.pulseaudio.org/wiki/SystemWideInstance The above URL warns people not to run Pulse Audio in "system mode".
I don't think I'd want to run Pulse Audio in "system mode". If possible, I'd like to know how to use these "cookies". It seems cookies are needed when switching users or over the network.
Hopefully someone who understands these choices can explain them to us. Hopefully they can also explain which choice is best for you. Hopefully they will give us a "cookbook" for setting up the best choice. If these are not good choices, hopefully they will offer another choice.
Some may say Pulse Audio is getting in the way and should not be used. I don't wish to participate in the Pulse Audio is good or bad debate.