run shell file on ubuntu by crontab

I am trying to make a task schedule on linux to run a file sh, however, it does not run by crontab, but runs when I do in hand.

I did a scheduling test to create a text file, it works, but to run sh does not.

Follows the Settings:

/etc/crontab Settings:

*/1 * * * * root /home/user/selamat.sh

Already tried like this:

*/1 * * * * root sh /home/user/selamat.sh

And so:

 */1 * * * * root (cd/home/user/ && ./selamat.sh >> Script.log 2>&1)

Shell script settings:

#!/bin/bash

zenity --info --text "SELAMAT";

ESE script opens a popup.

Author: Homer Simpson, 2017-06-08

1 answers

First, you should be given permission to run the script(maybe you already did).

chmod +x /home/user/selamat.sh

Put in crontab:

*/1 * * * * /home/user/selamat.sh

If you want to edit the file of the current crontab user. It can be tbm permission.

crontab -e

After this is done, run the command: crontab/etc / crontab

Then I restarted the cron

/etc/init.d/cron restart

Come back to us when you can. ;)

 1
Author: Marcos Paulo, 2018-07-12 16:44:41