0

Apologies, but a bit of a newbie when it comes to Ubuntu but I am going out of my head with this and need some help.

I have a script that I have written that works is I execute it by itself. :-

#!/bin/bash                                                                                                                                                                                   
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:~/bin                                                                                                                             
cd environments                                                                                                                                                                               
cd Garmin                                                                                                                                                                                     
cd Sync                                                                                                                                                                                       
python3 sync.py -f 2018-01-01 -t 2025-01-01

The issue is that I have a crontab job for it to run every hour, but it is not running (as it is not updating weight measurements)

00 * * * * ~/bin/sync.sh 

Can anyone help. Apologies but just starting out if the coding looks long winded.

Thanks

JJ28
  • 1

1 Answers1

0

I came across this post which should help point you in the right direction.

If the first answer does not help fix you issue then you can use the second answer which is written by Byte Commander. Byte Commander shows a nice way to accomplish your goal without having to deal with cron. You would just have to change the 10m to 60m or so

To avoid cron, you could also call your script in an infinite loop with a delay of 10 >minutes.

If you want to launch the script again 10 minutes after the previous instance exited, >use this:

while true ; do /PATH/TO/SCRIPT.PY ; sleep 10m ; done

However, if you want to launch the script every 10 minutes on the clock, no matter >how long the last instance was running (or whether it still is running), you must >execute the script in background and sleep in parallel by replacing the ; with an &:

while true ; do /PATH/TO/SCRIPT.PY & sleep 10m ; done

Gordster
  • 1,700