#!/bin/bash

if [ $# -lt 1 ]; then
	echo "Usage: $0 <jobname>"
	exit 1
fi

jobname=$1
if [ ! -d /cgroup/$jobname ]; then
	echo "/cgroup/$jobname does not exist"
	exit 1
fi

# move ourselves into the child's cgroup
echo $$ > /cgroup/$jobname/tasks
nsexec -m /usr/bin/restart_real.sh $*
