Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
    
How you access the cron tab? sudo cron -e? or cron -e? – Braiam Nov 8 '13 at 2:10
    
just "crontab -e" – Dmitry Narkevich Nov 8 '13 at 3:07
    
Not pretty sure why this doesn't work, but can you try changing the last line of your crontab to * * * * * sh headsetfix – i08in Nov 8 '13 at 4:01
    
Nope, that doesn't help. Maybe the fact that it writes to stdout has to do with it? dmitry@dmibuntu:~$ sh /usr/local/bin/headsetfix Welcome to PulseAudio! Use "help" for usage information. >>> >>> Welcome to PulseAudio! Use "help" for usage information. >>> >>> dmitry@dmibuntu:~$ – Dmitry Narkevich Nov 8 '13 at 4:26
    
Screw it, it'll probably be easier to just have a separate script run headsetfix and then sleep for a bit, looping forever. – Dmitry Narkevich Nov 8 '13 at 4:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.