ontime-dev / ont

MIT License
0 stars 0 forks source link

Check if the argument of --from is valid. #18

Closed HassanAlsamahi closed 2 months ago

HassanAlsamahi commented 2 months ago

Currently if someone inserted a date that is in the past to ont run --from <past-date>. It will insert the job and the next execution time will be in the past, hence, an ont start -r <jobid> will be required.

Need to check if the argument is valid.

Actual result: [golang@fedora ~]$ date Thu Jul 25 12:24:23 PM CEST 2024 [golang@fedora ~]$ ont run --every 1d --from 23-03-2024 ./test.sh Script: /home/golang/test.sh Next Execution time: 12:24:26 Mar 23 2024 Interval: 12:24:26 Mar 23 2024

Continue?(n/Y): Okay. New job '4' is created. [golang@fedora ~]$ ont list ID Script Next Execution Time Intervals Status Run on

1 | /home/golang/test.sh | 21:33:23 Jul 24 2024 | 1d | Active | local 2 | /home/golang/test.sh | 12:20:25 Mar 24 2024 | 1d | Active | local 3 | /home/golang/test.sh | 12:22:18 Jul 26 2024 | 1d | Active | 4 | /home/golang/test.sh | 12:24:26 Mar 23 2024 | 1d | Active | local <<<< In the past.

Expected result: [golang@fedora ~]$ ont run --every 1d --from 23-03-2024 ./test.sh Invalid date to run from. (Or something like that)