1

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.

Dmiters
  • 238
  • 1
  • 12
  • How you access the cron tab? `sudo cron -e`? or `cron -e`? – Braiam Nov 08 '13 at 02:10
  • just "crontab -e" – Dmiters Nov 08 '13 at 03:07
  • Not pretty sure why this doesn't work, but can you try changing the last line of your crontab to `* * * * * sh headsetfix` – jobin Nov 08 '13 at 04: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:~$ ` – Dmiters Nov 08 '13 at 04:26
  • Screw it, it'll probably be easier to just have a separate script run headsetfix and then sleep for a bit, looping forever. – Dmiters Nov 08 '13 at 04:50
  • 1
    Does this answer your question? [Cannot create a crontab job for my scrapy program](https://askubuntu.com/questions/1288111/cannot-create-a-crontab-job-for-my-scrapy-program) – Pablo Bianchi Jan 06 '21 at 19:15
  • Dunno man it's been over 7 years since I faced this problem. My current system doesn't even have cron so who knows. – Dmiters Jan 20 '21 at 04:02

0 Answers0