Oh! I just forgot to say that my user belongs to "audio" group.

And that it worked yesterday (i.e. before I rebooted & updated my Ubuntu
15.10)!!!!!

** Description changed:

  Arrrrrrggggggg.... This is driving me crazzzzzyyyy....
  
  Not sure this is the right place, but I can't find why pa refuses to
  play my sound!!!!
  
  I'm trying to play a sound every hour, so I added the following line to my 
/etc/crontab:
  0 */1 * * *   user /home/user/Softs/alarm.sh
  
  My alarm.sh script is:
  #!/usr/bin/env bash
  export DISPLAY=:0
  export XAUTHORITY=/home/user/.Xauthority
  /usr/bin/mplayer -ao pulse -vo null /home/user/.sounds/alarm_clock_short.ogg
  
- When I redirect the output of mplayer, I get: 
+ When I redirect the output of mplayer, I get:
  AO: [pulse] Init failed: Connection refused
  Failed to initialize audio driver 'pulse'
  
  I don't understand why, since cron is supposed to run the command as
  "user".
  
  I've tried millions of things:
  $ env -i
- $ /home/gmuller/Softs/alarm.sh 
+ $ /home/user/Softs/alarm.sh
  => works
  $ env -i
  $ sh
- $ /home/gmuller/Softs/alarm.sh 
+ $ /home/user/Softs/alarm.sh
  => works
  $ env -i
- $ . /home/gmuller/Softs/alarm.sh 
+ $ . /home/user/Softs/alarm.sh
  => works
  $ env -i
  $ sh
- $ . /home/gmuller/Softs/alarm.sh 
+ $ . /home/user/Softs/alarm.sh
  => works
  $ env -i
  $ sh
- $ su gmuller -c '/usr/bin/paplay /home/gmuller/.sounds/alarm_clock_short.ogg 
> /tmp/paplay_alarm 2>&1'
+ $ su user -c '/usr/bin/paplay /home/user/.sounds/alarm_clock_short.ogg
  => asks for passwd, but works
  
  I've also changed the last line of my alarm.sh script with:
  /usr/bin/paplay /home/user/.sounds/alarm_clock_short.ogg
  or:
- su gmuller -c '/usr/bin/paplay /home/gmuller/.sounds/alarm_clock_short.ogg > 
/tmp/paplay_alarm 2>&1'
+ su gmuller -c '/usr/bin/paplay /home/user/.sounds/alarm_clock_short.ogg'
  
  I get the (same) error:
  Connection failure: Connection refused
  pa_context_connect() failed: Connection refused
  
  Is the problem with my knowledge of pulseaudio, with pulseaudio's right
  management, or am I just crazily stupid?

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to pulseaudio in Ubuntu.
https://bugs.launchpad.net/bugs/1575118

Title:
  "AO: [pulse] Init failed: Connection refused" with mplayer from cron

Status in pulseaudio package in Ubuntu:
  New

Bug description:
  Arrrrrrggggggg.... This is driving me crazzzzzyyyy....

  Not sure this is the right place, but I can't find why pa refuses to
  play my sound!!!!

  I'm trying to play a sound every hour, so I added the following line to my 
/etc/crontab:
  0 */1 * * *   user /home/user/Softs/alarm.sh

  My alarm.sh script is:
  #!/usr/bin/env bash
  export DISPLAY=:0
  export XAUTHORITY=/home/user/.Xauthority
  /usr/bin/mplayer -ao pulse -vo null /home/user/.sounds/alarm_clock_short.ogg

  When I redirect the output of mplayer, I get:
  AO: [pulse] Init failed: Connection refused
  Failed to initialize audio driver 'pulse'

  I don't understand why, since cron is supposed to run the command as
  "user".

  I've tried millions of things:
  $ env -i
  $ /home/user/Softs/alarm.sh
  => works
  $ env -i
  $ sh
  $ /home/user/Softs/alarm.sh
  => works
  $ env -i
  $ . /home/user/Softs/alarm.sh
  => works
  $ env -i
  $ sh
  $ . /home/user/Softs/alarm.sh
  => works
  $ env -i
  $ sh
  $ su user -c '/usr/bin/paplay /home/user/.sounds/alarm_clock_short.ogg
  => asks for passwd, but works

  I've also changed the last line of my alarm.sh script with:
  /usr/bin/paplay /home/user/.sounds/alarm_clock_short.ogg
  or:
  su gmuller -c '/usr/bin/paplay /home/user/.sounds/alarm_clock_short.ogg'

  I get the (same) error:
  Connection failure: Connection refused
  pa_context_connect() failed: Connection refused

  Is the problem with my knowledge of pulseaudio, with pulseaudio's
  right management, or am I just crazily stupid?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1575118/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to