How to start an image with PORT parameter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
43 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Mariano Martinez Peck
Thanks to all of you. Now I have these 2 beautiful scripts:

startMyApp.sh:


#!/bin/sh
#settings
NOHUP="/usr/bin/nohup"
VM="/home/mariano/squeak/expury/build/squeak"
# Para produccion, como no van a estar las X, tengo que poner el -vm-display-null
VM_PARAMS="-mmap 200m -vm-sound-null"
IMAGE="destinoMochila.image"
#start the vm
$NOHUP "$VM" $VM_PARAMS "$IMAGE" &
# store in a file the PID of squeakVM
echo $! > evince.pid


stopMyApp.sh:

#!/bin/bash
PID=`cat evince.pid`
kill -15 $PID || exit 0
sleep 2
kill -2 $PID || exit 0
sleep 2
kill -1 $PID || exit 0
sleep 2
kill -9 $PID || exit 0


Thanks for the help!

Mariano



On Sun, Jul 26, 2009 at 7:58 PM, Randal L. Schwartz <[hidden email]> wrote:
>>>>> "Mariano" == Mariano Martinez Peck <[hidden email]> writes:

>> Generally, send 15 (SIGTERM), and wait a second or two, and if that
>> doesn't work, send 2 (SIGINT), and if that doesn't work, send 1
>> (SIGHUP).  If that doesn't, REMOVE THE BINARY because the program is
>> badly behaved!
>>

Mariano> Ok.....but how can I do this from a script ?

kill -15 $PID || exit 0
sleep 2
kill -2 $PID || exit 0
sleep 2
kill -1 $PID || exit 0
sleep 2
kill -9 $PID || exit 0

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: How to start an image with PORT parameter

Sebastian Sastre-2
Now you have a PID for the image you can even monitor and program reactions (like restarting a service) if something goes wrong with it (no PID, not opening connections in a port, etc).
Monit can do that for you (http://mmonit.com/monit/).
cheers,
sebastian


De: [hidden email] [mailto:[hidden email]] En nombre de Mariano Martinez Peck
Enviado el: Sunday, July 26, 2009 20:12
Para: Randal L. Schwartz
CC: Seaside - general discussion
Asunto: Re: [Seaside] How to start an image with PORT parameter

Thanks to all of you. Now I have these 2 beautiful scripts:

startMyApp.sh:


#!/bin/sh
#settings
NOHUP="/usr/bin/nohup"
VM="/home/mariano/squeak/expury/build/squeak"
# Para produccion, como no van a estar las X, tengo que poner el -vm-display-null
VM_PARAMS="-mmap 200m -vm-sound-null"
IMAGE="destinoMochila.image"
#start the vm
$NOHUP "$VM" $VM_PARAMS "$IMAGE" &
# store in a file the PID of squeakVM
echo $! > evince.pid


stopMyApp.sh:

#!/bin/bash
PID=`cat evince.pid`
kill -15 $PID || exit 0
sleep 2
kill -2 $PID || exit 0
sleep 2
kill -1 $PID || exit 0
sleep 2
kill -9 $PID || exit 0


Thanks for the help!

Mariano



On Sun, Jul 26, 2009 at 7:58 PM, Randal L. Schwartz <[hidden email]> wrote:
>>>>> "Mariano" == Mariano Martinez Peck <[hidden email]> writes:

>> Generally, send 15 (SIGTERM), and wait a second or two, and if that
>> doesn't work, send 2 (SIGINT), and if that doesn't work, send 1
>> (SIGHUP).  If that doesn't, REMOVE THE BINARY because the program is
>> badly behaved!
>>

Mariano> Ok.....but how can I do this from a script ?

kill -15 $PID || exit 0
sleep 2
kill -2 $PID || exit 0
sleep 2
kill -1 $PID || exit 0
sleep 2
kill -9 $PID || exit 0

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Mariano Martinez Peck


On Tue, Jul 28, 2009 at 11:05 AM, Sebastian Sastre <[hidden email]> wrote:
Now you have a PID for the image you can even monitor and program reactions (like restarting a service) if something goes wrong with it (no PID, not opening connections in a port, etc).
Monit can do that for you (http://mmonit.com/monit/).

I wasn't aware of that tool. Seems very useful. However, in my case I think the costs (in hardware) of the tool is bigger than the benefits. I have (actually, I will have hehehe) a slice of 256 RAM with apache2 and a seaside/pier application. I think I will use Debian.
Most of the features I saw in monit can be done  trought ssh and I think this way I use less resources (top, restarting apache, etc.). What do you think ?

Cheers,

Mariano
 
cheers,
sebastian


De: [hidden email] [mailto:[hidden email]] En nombre de Mariano Martinez Peck
Enviado el: Sunday, July 26, 2009 20:12
Para: Randal L. Schwartz
CC: Seaside - general discussion
Asunto: Re: [Seaside] How to start an image with PORT parameter

Thanks to all of you. Now I have these 2 beautiful scripts:

startMyApp.sh:


#!/bin/sh
#settings
NOHUP="/usr/bin/nohup"
VM="/home/mariano/squeak/expury/build/squeak"
# Para produccion, como no van a estar las X, tengo que poner el -vm-display-null
VM_PARAMS="-mmap 200m -vm-sound-null"
IMAGE="destinoMochila.image"
#start the vm
$NOHUP "$VM" $VM_PARAMS "$IMAGE" &
# store in a file the PID of squeakVM
echo $! > evince.pid


stopMyApp.sh:

#!/bin/bash
PID=`cat evince.pid`
kill -15 $PID || exit 0
sleep 2
kill -2 $PID || exit 0
sleep 2
kill -1 $PID || exit 0
sleep 2
kill -9 $PID || exit 0


Thanks for the help!

Mariano



On Sun, Jul 26, 2009 at 7:58 PM, Randal L. Schwartz <[hidden email]> wrote:
>>>>> "Mariano" == Mariano Martinez Peck <[hidden email]> writes:

>> Generally, send 15 (SIGTERM), and wait a second or two, and if that
>> doesn't work, send 2 (SIGINT), and if that doesn't work, send 1
>> (SIGHUP).  If that doesn't, REMOVE THE BINARY because the program is
>> badly behaved!
>>

Mariano> Ok.....but how can I do this from a script ?

kill -15 $PID || exit 0
sleep 2
kill -2 $PID || exit 0
sleep 2
kill -1 $PID || exit 0
sleep 2
kill -9 $PID || exit 0

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
123