Cronjob not running

Please excuse, I have very little Linux knowledge.
I’ve got a dietpi running on pi400.
I’m trying to automate downloading haahtag on instagram.

I’ve got the script right, if I run it in cmd it works.
I’ve created a file inside /etc/cron.hourly/
The file is called instagram.

It works by just typing the path of the file.
Ie /etc/cron.hourly/instagram

The problem is that it won’t run automatically.
I’ve done the chmod x to make it be able to run.
Not sure what else I’m missing.

The contents of the instagram file is:
#!/bin/bash
CD /home/dietpi/insta
Instaloader xx

you shouldn’t need the command to “CD” to the directory

In the bash script provide the exact path to the script needed to run such as

#!/bin/bash
/home/dietpi/insta/Instaloader.sh

or whatever you have the script saved as

you could try to execute the file from ctrontab directly. Just open it with ctrontab -e

Thanks for that.
I edited the file inside /etc/crontab.hourly to reflect.

Inside that file is now just

#!/bin/bash
/home/dietpi/insta/Instaloader.sh

However, nothing happens.
I checked htop and the command never launches.
If I execute it from commandline - ie. /etc/crontab.hourly/instaloader.sh it works fine.

1 Like

just some general remarks

  1. Files in /etc/cron.*/ are not allowed to have file endings, hence rename abc.sh to abc
  2. Take care it has the shebang #!/bin/bash (or whichever shell works), as those files are not explicitly executed with a specific shell.
  3. Take care it is executable: chmod +x /etc/cron.hourly/abc
  4. Check if it would be executed: run-parts --test /etc/cron.hourly/

I hope /etc/crontab.hourly was a typo on your post, as it would need to be /etc/cron.hourly

1 Like

Have the same problem

Great, had the same problem.
My crontab programme for transmitting temperature, air pressure and humidity to ThingSpeak did not work.
It was only after your tip that I got it to work. Now it works as planned.
Thank you!

good it is working now. However pls try to use English within the forum as we are an international community. Feel free to use translation tools like DeepL. For now, I translate all your post. Thx for understanding.

1 Like