1

I have this script for file show.sh

#!/bin/sh
zenity --warning --text "here"

in crontab i have this line

* * * * * /home/user/Public/show.sh

then i restarted my crontab

user@user-170:~/Public$ sudo /etc/init.d/cron restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service cron restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop cron ; start cron. The restart(8) utility is also available.
cron stop/waiting
cron start/running, process 5672
user@user-170:~/Public$

but I am waiting and nothing is happening and when i open Schedule Task software and run the script from there is show me a pop-up.

Why is this not work from crontab ?

NGRhodes
  • 9,490
Iori
  • 1,067

2 Answers2

1

Two mistakes

there should be "="

--text="here"

and adding --display=:0.0 to display the output

/usr/bin/zenity --warning --text="here"  --display=:0.0

and now it works like a charm!

Iori
  • 1,067
0

You have set the cron wrong give the entry in the cron like this

*/1 * * * * /bin/sh /home/user/Public/show.sh

this will execute the script on every minute basis.

Also make sure the script has execution permission by using the command

chmod +x /home/user/Public/show.sh
Tarun
  • 4,245
  • 13
  • 50
  • 74
  • i have changed it and you said /1 * * * /bin/sh /home/user/Public/show.sh > /dev/null 2>&1 and transfering the out to null but still nothing will happen – Iori Oct 07 '13 at 13:52
  • 1
    see the following link http://askubuntu.com/questions/23009/reasons-why-crontab-does-not-work – Tarun Oct 07 '13 at 14:07
  • Thanks buddy this helped a lot and i also found this answer too. http://stackoverflow.com/questions/1584411/how-to-run-an-x-program-from-outside-the-x-session-e-g-from-the-console-or-ssh – Iori Oct 09 '13 at 14:30