Skip to content

Instantly share code, notes, and snippets.

@mikezaccardo
Last active November 10, 2015 14:27
Show Gist options
  • Save mikezaccardo/b9a7c87086cca5d703e5 to your computer and use it in GitHub Desktop.
Save mikezaccardo/b9a7c87086cca5d703e5 to your computer and use it in GitHub Desktop.
SameServerEntity Example
name: "SameServerEntity Example"
location: localhost
services:
- type: org.apache.brooklyn.entity.software.base.SameServerEntity
id: parent
name: Parent Entity
children.startable.mode: background_late
brooklyn.children:
- serviceType: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
id: item-A
name: A
launch.command: |
echo hello | nc -l 4321 &
echo $! > $PID_FILE
echo "A: launch.command executed"
env: { CHECK_MARKER: "checkRunning", STOP_MARKER: "stop" }
checkRunning.command: echo $CHECK_MARKER >> DATE && test -f "$PID_FILE" && ps -p `cat $PID_FILE` >/dev/null
stop.command: echo $STOP_MARKER >> DATE && test -f "$PID_FILE" && { kill -9 `cat $PID_FILE`; rm /tmp/vanilla.pid; }
- serviceType: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
id: item-B
name: B
launch.command: |
echo hello | nc -l 4322 &
echo $! > $PID_FILE
echo "B: launch.command executed"
env: { CHECK_MARKER: "checkRunning", STOP_MARKER: "stop" }
checkRunning.command: echo $CHECK_MARKER >> DATE && test -f "$PID_FILE" && ps -p `cat $PID_FILE` >/dev/null
stop.command: echo $STOP_MARKER >> DATE && test -f "$PID_FILE" && { kill -9 `cat $PID_FILE`; rm /tmp/vanilla.pid; }
@johnmccabe
Copy link

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment