On Fri, Jul 31, 2009 at 12:17 AM, Aaron Rosenzweig <aaron@cocoanutstech.com> wrote:
Hello All,

Does anyone run Pier headless on Mac OS X? I saw the nice tutorial here:

http://www.piercms.com/doc/deploy

But it only deals with starting up the VM and not how to close it gracefully when the entire server reboots.

I'm thinking of something along the lines of using "systemstarter" in Tiger or "launchctl" in Leopard. These both automatically issue a "start" and "stop" script. For example:

sudo systemstarter start "WebObjects Services"

or

sudo launchctl start com.apple.webobjects.wotaskd

I am sorry I don't know how Mac works, but I can tell you what I do in Linux (with other's help in a seaside thread)

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

This has three nice things:

1) Doesn't do a kill -9 first but it tries to kill the process with better signals

2) I store the pid in a file so that then I know which process to kill

3) I use nohup so that I can start the process and then close the terminal (suppose you are trough ssh).

I hope this helps,

Mariano

 

Thanks,
-- Aaron
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki