How to work with rainbow and in cron

Common commands (outside the terminal) end with errors

In terminal is command ready rainbow brightness -p 5

but in cron

# SUMMER
00 06 * * * rainbow brightness -p 10
00 07 * * * rainbow brightness -p 16
00 08 * * * rainbow brightness -p 30
00 19 * * * rainbow brightness -p 16 
00 20 * * * rainbow brightness -p 10
00 21 * * * rainbow brightness -p 5

wir error
Aug 21 06:00:00 Turris_JB crond[6110]: (rainbow) ERROR (getpwnam() failed - user unknown): No such file or directory

changing to /usr/bin/rainbow does not change anything

Wrong cron syntax. Add “root” before rainbow word and it should work

1 Like

For me it’s working without problems, tested just now to be sure:

47 10 * * * rainbow brightness 0 # switch LEDs off
48 10 * * * rainbow brightness -p 10 # switch LEDs on

TOS 7.0.2

@JardaB & @jada4p …

It depends on which crontab you are referring to.

There are system crontabs and user crontabs.

Tasks in user crontabs always run as the user they belong too.

Tasks in system crontab need the user profile, which they are supposed to run as, as argument between the start-time and the command to run (much like sudo -u user command):

System crontabs are in /etc/cron.d/:

# min hour mday month wday user  command
  00  06   *    *     *    root  rainbow brightness -p 10
  00  07   *    *     *    root  rainbow brightness -p 16
  00  08   *    *     *    root  rainbow brightness -p 30
  00  19   *    *     *    root  rainbow brightness -p 16 
  00  20   *    *     *    root  rainbow brightness -p 10
  00  21   *    *     *    root  rainbow brightness -p 5

The users crontab for root on TOS is in /etc/crontabs/root:

# min hour mday month wday cmd
  47  10   *    *     *    rainbow brightness 0
  48  10   *    *     *    rainbow brightness -p 10
2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.