0

Hell My name is Patrick and a Rpi newbi. I have made this project" industrial strenght cat feeder" from the instructables website. Everything is working 100% aside from the crontab function. Ths crontab is running ( i see the log's) but not executing the command. This is the original crontab command :

10 */1 * * * sh /var/www/html/camera.sh >> /home/icf/logs/camera 2>&1
0 * * * * sh /home/icf/catFeeder/checkDispenseFood.sh >> /home/icf/logs/cronlog  2>&1

The locations and sh names are correct.Timing also. Then i have read to delete the sh after the crontab *****. So i changed to this:

10 */1 * * * /var/www/html/camera.sh >> /home/icf/logs/camera 2>&1
0 * * * * /home/icf/catFeeder/checkDispenseFood.sh >> /home/icf/logs/cronlog  2>&1

Same result:.... nothing.

Can anybody give some advice? Can i manually run the crontab command to test because in the "sh" the time is compared to a setting txt table ( with 3 programmable times per day) every hour on the hour. This also works as i can see the logs for checking the table every hour.

5
  • If you want help you need to explain What YOU did and what you hope to achieve. You haven't even provided a link to the the instructables(sic) website (although lots of stuff there is rubbish)
    – Milliways
    Jul 17 '21 at 7:51
  • Thank you very much for the contributing answer.
    – Patrick
    Jul 17 '21 at 9:21
  • Have you looked inside the /home/icf/logs folder, and examined the contents of the camera and the cronlog files? The project's website has a **ASK QUESTIONS** link - did you try that?
    – Seamus
    Jul 17 '21 at 19:40
  • Yes did ask them but no reaction
    – Patrick
    Jul 19 '21 at 10:56
  • even after testing the command as the user whose crontab it is scheduled to, remove any dependencies on something in your environment that are not in the one cron runs (use absolute paths, etc). also try replacing actual jobs with some simple hello world to see outputs.
    – Abel
    Dec 17 '21 at 2:09
0

I would run through the following checks:

  1. Ensure your script is executable, make sure you can run it standalone from the command line /home/icf/catFeeder/checkDispenseFood.sh you may have to use chmod +x to do this. Bear in mind that cron is not running as your userid so the script will need to be executable by cron.

  2. Edit your script to include the shell you want to use on the first line of the script e.g. #!/bin/sh or #!/bin/bash or similar.

  3. Use a cron editor e.g. https://crontab.guru/ to get the syntax right for the schedule you want. Use crontab -e to edit and update the crontab file.

  4. You can test the run by simply putting a line into the crontab that is a minute or two later than the current time and checking it has run e.g. 5 * * * * will run at 5 minutes past the hour.

More useful information here https://pimylifeup.com/cron-jobs-and-crontab/

1
  • I would run through the following checks: 1: I did and it works this way. ???? 2: This line is present in the crontab file. 3: Timing is ok. I used GURU also. 4: timing is working.
    – Patrick
    Jul 19 '21 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.