5

In crontab is it possible to specify a user from a variable?

view full story
linux-howto

http://unix.stackexchange.com – I am trying to have the following cron executed with a certain user. U=`/usr/bin/w | grep -w :0 | awk '{ print $1 }'` */1 * * * * $U /opt/script.sh It seems the deamon doesn't know how to interpret this command; I get : /usr/sbin/cron[18698]: (CRON) bad username (/etc/cron.d/script) Is there any way to do this ? Thanks (HowTos)