Why won't cron run my sh script?
- by Dmitry Narkevich
Used gnome-schedule to create a script to set my headset as the fallback audio device because it keeps unsetting it when the headset gets disconnected or pc goes into sleep mode.
Anyway, crontab is this:
SHELL=/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/home/dmitry/bin
* * * * * headsetfix
/home/dmitry/bin/headsetfix is
#!/bin/sh
pacmd set-default-sink alsa_output.usb-Logitech_Inc_Logitech_USB_Headset_H540_00000000-00-H540.analog-stereo
pacmd set-default-source alsa_input.usb-Logitech_Inc_Logitech_USB_Headset_H540_00000000-00-H540.analog-stereo
It runs fine from the terminal.
I've made sure it's chmodded to be executable, and "which headsetfix", run from cron, outputs "/home/dmitry/bin/headsetfix" so not sure what the problem is.