tmuxjail.sh
· 331 B · Bash
Eredeti
#!/usr/bin/env zsh
if [ -z "$1" ]; then
echo "Usage: $0 <jailname>"
exit 1
fi
JAILT="jail-$1"
JAIL="$1"
if tmux has-session -t "$JAILT" 2>/dev/null; then
echo "attaching to existing : $JAILT"
tmux attach -t "$JAILT"
else
echo "attaching new : $JAILT"
tmux new -s "$JAILT" "sudo bastille console $JAIL"
fi
| 1 | #!/usr/bin/env zsh |
| 2 | |
| 3 | if [ -z "$1" ]; then |
| 4 | echo "Usage: $0 <jailname>" |
| 5 | exit 1 |
| 6 | fi |
| 7 | |
| 8 | JAILT="jail-$1" |
| 9 | JAIL="$1" |
| 10 | |
| 11 | if tmux has-session -t "$JAILT" 2>/dev/null; then |
| 12 | echo "attaching to existing : $JAILT" |
| 13 | tmux attach -t "$JAILT" |
| 14 | else |
| 15 | echo "attaching new : $JAILT" |
| 16 | tmux new -s "$JAILT" "sudo bastille console $JAIL" |
| 17 | fi |