A hidden process can still be killed if you know it's process id (pid). Many systems store the pid of all the processes started at boot time somewhere under /var (/var/run is commonly used). Your shutdown scripts can be modified to read the pids from these files and send them the appropriate signals.
For example, if your system stores the pids in /var/run/<process_name>.pid, then you can add the following lines to your shutdown scripts:
for p in `ls /var/run/*.pid` do kill -15 `cat $p` done sleep 5 sync;sync;sync for p in `ls /var/run/*.pid` do kill -9 `cat $p` done sleep 5 sync;sync;sync |
Another option would be to just send every process the TERM and KILL signals.
MAX_PROC=65535
trap : 1 2 15
I=1;while (( $I < $MAX_PROC ));do
I=$(($I+1));
if (( $$ != $I ));then
kill -15 $I;
fi;
done
sleep 5
sync;sync;sync;
I=1;
while (( $I < $MAX_PROC ));do
I=$(($I+1));
if (( $$ != $I ));then
kill -9 $I;
fi;
done
sync;sync;sync |
Nenad Micic wrote his own C program to kill hidden processes at shutdown.