I have a cron job that runs a shell script that executes a php script. It runs every day, sends some email, and writes to stdout (which is redirected to a log file in the shell script).
It looks as though this process has finished, today, but not exited (or whatever the correct terminology is!).
$ ps -ejH
...
10756 10756 10756 ? 00:00:00 sh
10760 10756 10756 ? 00:00:00 automail.sh
10766 10756 10756 ? 00:03:57 php
...
The process with id 10766
has consumed just under 4 minutes of CPU time. From an interactive top session, I get the following:
10766 root 20 0 40640 6024 4 S 0.0 0.2 3:57.48 php
Those hundredths haven't changed since I've looked at it. So my conclusion is that it's doing ... almost nothing, at the very most.
$ ls -ld /proc/10766/
dr-xr-xr-x 7 root root 0 2016-03-09 08:55 /proc/10766/
tells me it's been going for some time; server time is now:
$ date
Wed Mar 9 11:08:29 GMT 2016
The last line of the php script writes to a log file, and that line is present in the log file. Execution of the php script is the final thing in the shell script.
How do I go about diagnosing why this process hasn't quit?
UPDATE
Here's an edited version of the shell script I'm running:
#!/bin/sh
DATE=$(date +%Y-%m-%d)
PHP=/usr/bin/php
SCRIPT=/path/to/script.php
LOG=/path/to/log.file.$DATE.log
$PHP $SCRIPT >> $LOG