I have a script that executes perfectly fine manually, though two commands in particular are completely ignored by Cron (this is just a snippet):
sinkint=$(pacmd list-sinks | sed -n '/index\W [1-9]/p' | sed 's/.*://g;s/\W//g')
pacmd set-default sink $sinkint
pacmd set-sink-volume $sinkint 20%
Crontab
* * * * * /path/to/script arg1 >> /path/to/log
Error messages
No PulseAudio daemon running, or not running as session daemon.
No PulseAudio daemon running, or not running as session daemon.
You have to specify a sink name/index and a volume
Edit:
tried variables in script
export PULSE_SERVER=unix:/tmp/pulse-socket
export PULSE_COOKIE=/tmp/pa_cookie
socket in my /etc/pulse/default.pa
load-module module-native-protocol-unix socket=/tmp/pulse-socket
socket and cookie in my /etc/pulse/client.conf
default-server = unix:/tmp/pulse-socket
cookie-file = /tmp/pa_cookie
crontab -e
PULSE_SERVER=unix:/tmp/pulse-socket
PULSE_COOKIE=/tmp/pa_cookie
* * * * * /path/to/script arg1 2> /path/to/log