Crontab as alarm clock with ogg123
rsewill at gmail.com
Sun Jul 25 07:06:30 UTC 2010
On 07/24/2010 02:55 PM, Robert Arkiletian 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?
> 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, 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.
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.
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".
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.
More information about the users