0

All the google results mention cron jobs. They don't work, I followed multiple guides exactly, and the script is never launched.

I just need to set the brightness to change at morning and dusk, it seems like a pretty simple task to me, but it's surprising that I can't figure it out. I use brightnessctl to control the brightness of my laptop, and it does not require sudo.

I'm running Arch Linux. Installed cronie, in terminal I crontab -e, and in the file I write 41 17 * * * dunstify "timer", which is the time a few minutes after I wrote that, as a test to see if it runs.

I save the file, I enable and start the cronie service in systemctl, then type crontab -l, and there's "no crontab for indeedwatson".

EDIT: Crontab error: no crontab For [user]

This post led me to this command sudo crontab -u indeedwatson -e from which I can create a crontab that does show up for crontab -l. I don't understand why. I'm using sudo to create it, but not to list them, and in any case, all the guides do not require the -u flag, to me it seems implied by running it without sudo, it's my own user.

9
  • 1. Brightness of what? Do you have some home automation system controlled by your computer? 2. What operating system are you on? If it is a Linux system, please also tell us which distro and which distro release. Thank you! Commented May 29, 2023 at 15:56
  • 3. Is your system running continuously, or to modify that brightness actuator needs to be awoken from sleep or booted? Commented May 29, 2023 at 15:57
  • 2
    4. you say "I followed multiple guides exactly": well, we need to know what exactly you did, otherwise we won't be able to help. Please add the contents of what ever scripts, crontables or other things you did to your question by editing it! Commented May 29, 2023 at 16:02
  • 2
    Rather than engage in guess work, it would be best to edit your question to include the exact text of your cron job. Commented May 29, 2023 at 16:07
  • 2
    Cron is rarely the right tool if what you want to do involves the graphical interface. Please edit your question, explain exactly what you want to achieve, on what operating system and what graphical environment, and we can try and help. It sounds like you just want something like jonls.dk/redshift. Commented May 29, 2023 at 16:22

1 Answer 1

0

Without knowing which Linux/Unix distribution you use, or what configuration changes you've made, or what command you've used in your cron job, it's tough to say for sure. I'll make some assumptions:

  1. Assuming that your brightness command actually works from the command line, and that it requires su privileges:

Instead of using the normal user crontab, use the root crontab; i.e. open your crontab for editing with sudo. In this way, your cron job will run with the required privileges:

sudo crontab -e
  1. Assuming you're not using a redirect to get the benefit of potentially helpful stderr & stdout, try that in your cron job; redirects are the >> to designate a file, and 2>&1 to include stderr and stdout :
...
0 7 * * * /full/path/to/bright-adj-pkg >> /home/user/mylog.txt 2>&1
0 19 * * * /full/path/to/bright-adj-pkg >> /home/user/mylog.txt 2>&1
...
2
  • I'm using brightnessctl, it does not require sudo Commented May 29, 2023 at 21:44
  • cronie is not cron. Commented May 30, 2023 at 5:03

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.