execute shell file in ubuntu by crontab

2

I'm trying to do a task schedule in linux to run a sh file, however, it does not run by crontab , but it does when done in the hand.

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

Here are the settings:

/ etc / crontab settings:

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

I've tried this:

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

And so:

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

The shell script settings:

#!/bin/bash

zenity --info --text "SELAMAT";

This script opens a popup.

    
asked by anonymous 08.06.2017 / 13:01

1 answer

0

First, permission should be given to execute the script (you may have already done so).

chmod +x /home/user/selamat.sh

Place in crontab:

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

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

crontab -e

After doing this, run the command:     crontab / etc / crontab

Then I rebooted cron

/etc/init.d/cron restart

Return us when you can. ;)

    
12.07.2018 / 18:44