I'm sorry for creating this thread, but i cant solve this issue myself.
I want crontab to execute basic command "xrandr --auto"
I've created an test.sh file that looks like this.
#!/bin/bash
xrandr --auto
After I have added following line to crontab -e
, I used default nano editor.
*/2 * * * * /home/dashboarduser/test.sh
Also tried like this
*/2 * * * * root /home/dashboarduser/test.sh
It does not work, I don't know why.
After some searching found this command grep CRON /var/log/syslog
to see the contents of cron logfile.
Dec 12 14:06:01 : (dashboarduser) CMD (root /home/dashboarduser/test.sh # JOB_ID_1)
Dec 12 14:06:01 : (CRON) info (No MTA installed, discarding output)
If i run my script in terminal -> /home/dashboarduser/test.sh
it works fine.
Thanks in advance.
sh
. @P75 you don't need the user field (e.g.root
) in jobs set up using thecrontab -e
command (only in those set up via/etc/crontab
). Most likely if you capture the errors from your command you will seexrandr
is complainingCan't open display
. – steeldriver Dec 12 '17 at 12:48