1

Cronjob creates multiple processes for the same script. One using

/usr/bin/php /path/to/php/script

And other using

/bin/sh -c /usr/bin/php /path/to/php/script

These are 2 separate processes. Why does this happen? I am running Ubuntu 14.10 server.

1 Answers1

1

In your case the

    /bin/sh -c /usr/bin/php /path/to/php/script

Is likely the parent of:

    /usr/bin/php /path/to/php/script

Cron will execute /bin/sh -c of the command you have in your crontab. /bin/sh will then spawn a child process of the actual command you want to run, in your case:

  /usr/bin/php /path/to/php/script
H K
  • 11
  • 1
  • Yes, correct, /bin/sh -c was the parent of /usr/bin/php.. process. The processes were executing script, making changes to the system, but were not killed. Not sure why and how. Anyways I have specified the SHELL=/bin/bash in my crontab, and it seems to execute only a single process. Thanks for your explanation. I believe crontab uses /bin/sh as the default shell. – Varun Sikka May 19 '16 at 06:49