#!/bin/sh [ $(id -u) = 0 ] || exec sudo $0 $@ . $(dirname $(realpath $0))/functions XXX NAME="$1" [ -z "$NAME" ] && echo "Select subhost: $(list_running)" && exit 0 read USPID RSPID <&2 && exit 1 if [ -z "$RSPID" ] ; then cat <&2 *** $NAME is started (pid $USPID) but doesn't seem to be running *** /.reaper and might need manual fixing. EOF exit 1 fi sudo nsenter -t "$RSPID" -n -m -p -r -w -i -u -C /bin/bash if [ $? = 137 ] ; then echo "######### please 'fg' this again (if stopped)" >&2 stty sane # a killed bash might leave the tty insane and stty # typically gets stopped trying to correct it fi echo "done"