2

i have two cronjobs, i want to run the two cronjobs at a small gap of ten minutes. once in two days, at 0100 hours and 0110 hours

this is what iam trying.

0 1 */2 * * job1.sh
10 1 */2 * * job2.sh

job1 is not working as expected. it runs twice everyday. job2 runs as expected (once in two days).
what am i doing wrong?

sk27
  • 23
  • 3
  • Possible duplicate of [cronjob does not execute a script that works fine standalone](http://stackoverflow.com/questions/36885909/cronjob-does-not-execute-a-script-that-works-fine-standalone) – fedorqui Apr 27 '16 at 11:43

1 Answers1

0

You need to add the binary executing the script, as well as the complete route to your file:

0 1 */2 * * /bin/sh /route/to/your/file/job1.sh
10 1 */2 * * /bin/sh /route/to/your/file/job2.sh

/bin/sh can be another thing, just get it from which sh.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
  • my script has a #!/bin/sh in the start. – sk27 Mar 21 '13 at 10:20
  • the scripts are running fine.. just that they are not firing at right time.. job1 is firing twice a day.. – sk27 Mar 21 '13 at 10:21
  • `0 1 */2 * *` is correct to schedule once every two days. It sound strange – fedorqui Mar 21 '13 at 10:30
  • By the way, although you have a `#!/bin/sh`, it is much recommendable to add `/bin/sh` to the cronjob line. Statistically, t is #1 solution for most problems. – fedorqui Mar 21 '13 at 10:46