Re: System V Init Script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



As you spotted john my killing loop was killing the system V script itself also hence it never starting my_app again, so instead a simple if skips the process ID of the system V script itself so it can continue on to start my_app again:


>       I'd think that the pgrep is matching both the processes you want
>       to kill _and_ the init.d script itself. 
 
My script looks like the following:


restart)
echo "Stopping my_app:"
pgrep my_app | while read PIDS
do
        if [ "$PIDS" -eq $$ ]; then
                continue
        fi
        kill -9 $PIDS
done
echo "Starting my_app:"
/etc/init.d/my_app start &
exit $?
;;

Thanks for the help everyone its greatly appreciated.

Regards,
James ;)
 

-----BEGIN GEEK CODE BLOCK-----
 Version: 3.1
GIT/MU/U dpu s: a--> C++>$ U+> L++> B-> P+> E?> W+++>$ N K W++ O M++>$ V-
PS+++ PE++ Y+ PGP t 5 X+ R- tv+ b+> DI D+++ G+ e(+++++) h--(++) r++ z++
------END GEEK CODE BLOCK------
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux