Hi Pablo! I use this script that automatically kills and restarts the
process, it may not be exactly what your looking for, but it may help!

#!/bin/sh

PID=`ps faux | grep aped | awk 'NR==2{print $2}'`
STATUS=`ps faux | grep aped | awk 'NR==2{print $1}'`
if [ "$STATUS" = "ec2-user" ]; then
 echo "ape already killed"
else
 sudo kill $PID
 echo "ape was killed"
fi
sleep 5
cd /home/ec2-user/ape-server/bin
./aped


Basically it checks the return response from ps faux | grep aped, and
it if does NOT return "daemon" then it means its not running (I always
run the server using daemon) otherwise it kills the process and then
restarts, I've found this most useful with the older versions of APE
due to it's memory consumption,

On Mar 29, 9:42 am, Pablo <[email protected]> wrote:
> I'm no the most bash literate person but I created a few scripts to START(in 
> background), SHUTDOWN and RESTART the server. I have to manually pass the PID 
> (Ex. RESTART 13946)
>
> I noticed that the Ape server logs the PID everytime it starts. I was 
> wondering how could I get the current(or last) PID so that i could automate 
> my RESTART and SHUTDOWN bash script.
>
> But what I really want to do is update my START script so that it checks if 
> the last logged PID still running before starting a new instance of the 
> server. That way I could set a cron job to periodically check if the is 
> running and if needs to be started.
>
> Ape Version 1.0 Binary installation

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to