FZE
FZE

Reputation: 1627

php shell_exec triggers a job twice

There is an issue I couldn't find the exact problem, or is it a problem anyway I don't know.

I execute below command through shell_exec in php. I'm user I called just once.

curl -o ./server.log --request POST 'crawlserver.xxx.local/workerCallback.php' --user-agent 'xxx' --data 'workerid=worker1&jobid=25&offercount=72&file='/path/to/xxx-2014-02-07-serialized.txt'

this command working like 30 seconds.

while when I ask to bash as ps aux | grep workerCallback

I see 2 different commands triggered, and different process ids. But when look to server.log file it is looking a single request, also I check db and other stuff, the request worked single. But why it is looking twice in commandline by different pids, and commands has little differences. What is the "sh -c" before the command.

1000 27384 0.0 0.0 4404 612 ? S 14:00 0:00 sh -c curl -o ./server.log --request POST 'crawlserver.xxx.local/workerCallback.php' --user-agent 'xxx' --data 'workerid=worker1&jobid=25&offercount=72&file=path/to/xxx-2014-02-07-serialized.txt'

1000 27385 0.0 0.0 88056 3756 ? S 14:00 0:00 curl -o ./server.log --request POST crawlserver.xxx.local/workerCallback.php --user-agent xxx --data workerid=worker1&jobid=25&offercount=72&file=/path/to/xxx-2014-02-07-serialized.txt

Upvotes: 1

Views: 538

Answers (1)

edmondscommerce
edmondscommerce

Reputation: 2011

Its not the same command twice, the first command is the shell (sh) running your curl command.

The second one is the command itself.

So your code is working fine :)

Upvotes: 3

Related Questions