Unable to schedule a Bash script

Asked by saadat

I have the following command in crontab but the script just doesn't schedule it self.

01,20,40 * * * * sh /home/saadat/Ubuntu\ One/Hobbies/Techy/BingImage.sh

Its just a script to download the bing image of the day and make it my desktop.

ANy Ideas why?

Regards

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu cron Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
N1ck 7h0m4d4k15 (nicktux) said :
#1

You can see in syslog if the cron job executed , maybe the script is wrong or not have the appropriate permissions to be executed.

Check scripts permissions with this command

~$ ls -l /home/saadat/Ubuntu\ One/Hobbies/Techy/BingImage.sh

And see if cron job executed with this command

~$ grep -i CRON /var/log/syslog

Also , I see you are interesting for the desktop wallpaper , take a look at this program

http://www.webupd8.org/2012/04/wallch-wallpaper-changer-for-gnome-3.html

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

chmod +x /home/saadat/Ubuntu\ One/Hobbies/Techy/BingImage.sh

Then you don't need the 'sh' command at the start. The file also doesn't need the '.sh' that people insist on adding to bash scripts, it means nothing in Linux. Windows uses the file extension to determine the type, Linux is advanced and looks at the file data to determine the file. You could even name it 'BingImage.jpg' and it would still be ran as a bash script, as the data in the file is still a bash script.

If you are using a desktop OS, you can install gnome-schedule and use that as a GUI to cron.

Can you help with this problem?

Provide an answer of your own, or ask saadat for more information if necessary.

To post a message you must log in.