Alright, I've been trying this for several days and I'm just dying here...

I am putting together a kiosk that should play video. I'm using a NUC with Raspberry Pi Desktop. Everything works but automating the audio with Cron. I work in a school and blasting sound during the day would kind of suck, so I want it to change based on the time of the day.

When run from terminal the following code works:

/usr/bin/amixer set Master 16384


amixer sset 'Master' 16384

So, I put it into Cron.

15 09 * * * /usr/bin/amixer set Master 16384


43 09 * * * amixer sset 'Master' 16384

Nothing. Fine. So I make a really simple python script to run.

#!/usr/bin/env python3

from subprocess import call
call(["/usr/bin/amixer", "set", "Master", "65536"])

I make it executable:

chmod +x /etc/python/sound100.py

Then I call it from the terminal with both:



/usr/bin/python3 /etc/python/sound100.py

Again, it works. Yay. Into Cron it goes. Neither:

11 10 * * * python3 /etc/python/sound100.py


11 10 * * * /usr/bin/python3 /etc/python/sound100.py

Not even

11 10 * * * /etc/python/sound100.py

Nothing works.

So begins the actual troubleshooting. I check the syslog. Everything runs, but I learn that when I run it as a sudo command it doesn't work. It says that the maximum volume is 83 when run as a sudoer. So that means I can't run it as from sudo crontab -e, but I start running it from the user's cron.

Still freaking nothing. So, alright, fine, I'll try running it as a sudoer but with the user beforehand. Nothing again.

I am exhausted and this isn't even my full-time job. I'm a librarian. I'm just technically inclined and had done this before with regular raspberry pi 4s. Just no volume because they weren't powerful enough.

Please help me. I just want to adjust the volume automatically without logging into a ssh for every NUC we're putting up.

  • 2
    This looks like a simple programming Question - nothing to do with Pi. Raspberry Pi Desktop - is a Linux OS with the Raspbian Look&Feel. Why would you put your undocumented program in a system directory?
    – Milliways
    Oct 9, 2021 at 0:05
  • Maybe try systemd and target something late in the boot process? Oct 9, 2021 at 23:10


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.