On Fri, Jan 24, 2025 at 17:36:54 -0500, e...@gmx.us wrote:
> OK.  My crontab has this:
> 
> XDG_RUNTIME_DIR="/run/user/$(id -u)"
> 
> # m h  dom mon dow   command
>  *  *  24  1   *   aplay /export/media/sounds/woow1.wav
> 
> At the minute, no sound.  I tried
> id=$(id -u)
> XDG_RUNTIME_DIR=/run/user/$id
> 
> and
> id=1000
> XDG_RUNTIME_DIR=/run/user/$id
> 
> and no dice.  I tried
> XDG_RUNTIME_DIR=/run/user/1000
> 
> and it worked.  Maybe this cron doesn't do variables in assignments?

The man page (crontab(5)) says:

       An  active line in a crontab will be either an environment setting or a
       cron command.  An environment setting is of the form,

           name = value

       where the spaces around the equal-sign (=) are optional, and any subseā€
       quent non-leading spaces in value will be part of the value assigned to
       name.  The value string may be placed in quotes (single or double,  but
       matching) to preserve leading or trailing blanks.

Assuming that it uses shell syntax would be a mistake.  If you need
some of the parameters to be processed by a shell, put them in the cron
command line, or in the script that the cron command calls.

Reply via email to