Why won't cron run my sh script?

Posted by Dmitry Narkevich on Ask Ubuntu See other posts from Ask Ubuntu or by Dmitry Narkevich
Published on 2013-11-08T01:47:30Z Indexed on 2013/11/08 4:19 UTC
Read the original article Hit count: 389

Filed under:
|

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.

© Ask Ubuntu or respective owner

Related posts about scripts

Related posts about cron