Skip to content

Commit

Permalink
New: a prototype vzmaster kill
Browse files Browse the repository at this point in the history
  • Loading branch information
nponeccop committed Apr 9, 2016
1 parent d77e0de commit b5eae0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions vzmaster/kill.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/env bash

set -ex -o pipefail
pgid=$(ps -o pgid= $(cat /run/opencontainer/chroots/$1/state.json | jshon -e init_process_pid -u) | awk '{print $1}')

container_id=$1
pid=$(cat /run/opencontainer/chroots/$container_id/state.json | jshon -e init_process_pid -u)
pgid=$(ps -o pgid="" $pid | awk '{print $1}')
sudo kill -- -$pgid

echo waiting for $pid to exit
while [ -d /proc/$pid ] ; do sleep 1; done
echo process $pid exited
$(dirname $0)/runch delete $container_id
3 changes: 2 additions & 1 deletion vzmaster/vzmaster-kill.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
- hosts: all
tasks:
- command: "{{ vzexec.path }}/bin/runch kill {{ vzexec.container_id }}"
- copy: src=kill.sh dest={{ vzexec.path }}/bin/kill mode=755
- command: "{{ vzexec.path }}/bin/kill {{ vzexec.container_id }}"

1 comment on commit b5eae0b

@nponeccop
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closes #39

Please sign in to comment.