0

I'm recording entries into crontab using PHP (www-data user). The first entry is a scheduler that runs every minute. If the scheduler finds a specific criteria it adds new entry to crontab. After I add an entry, the scheduler (that should run every minute) stops working. The cron jobs aren't running in parallel. It is like the www-data user could only execute a single cron job.

My scheduler, which works when it's the only thing in the crontab:

* * * * * curl --silent http://myapi_url/scheduler >/dev/null 2>&1

When the scheduler runs, it adds a new entry:

18-59/2 * * * * curl --silent http://myapi_url/user/10 >/dev/null2>&1`

So the new entry works, but the scheduler stops working. If I add yet another new entry, the two previously added stop working but not the new one. Why?

EDIT:

The crontab looks like this:

* * * * * curl --silent http://myapi_url/scheduler >/dev/null 2>&1 
18-59/2 * * * * curl --silent http://myapi_url/user/10 >/dev/null 2>&1

each new entry comes below.

3
  • Because you are doing it wrong .. what are the content of your crontab after adding the second entry ? What command are you using to add the second and following entry to crontab ?
    – Soren A
    Jan 24, 2018 at 18:59
  • @SorenA I edited my answer. Jan 24, 2018 at 21:52
  • Please use either four spaces at the beginning of a line or the {} button in the editor to format blocks of fixed-width text. Jan 24, 2018 at 23:40

1 Answer 1

0

I found the problem. When writing to Crontab I was using the line break incorrectly and due to this at the end of the entry a ^M was recorded.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .