sporo zmian, nie pamiętam czego :)
This commit is contained in:
51
bin/ec2-tmux
Executable file
51
bin/ec2-tmux
Executable file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
#set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
SESSION=$AWS_PROFILE
|
||||
EC2_INSTANCES=$(aws ec2 describe-instances --filter "Name=instance-state-name,Values=running" --query "Reservations[*].Instances[*].[PublicIpAddress, Tags[?Key=='Name'].Value|[0]]" --output text|sed -E 's/\s+/,/g')
|
||||
|
||||
get_window() {
|
||||
NAME=$1
|
||||
window_id=$(tmux list-windows -t $SESSION -F "#W:#I" |grep $NAME|cut -d':' -f2)
|
||||
echo "$window_id"
|
||||
}
|
||||
|
||||
create_window() {
|
||||
NAME=$1
|
||||
COUNT=$(tmux list-windows -t $SESSION|wc -l)
|
||||
WINDOW_ID=$(($COUNT))
|
||||
tmux new-window -t $SESSION:$WINDOW_ID -n $NAME
|
||||
}
|
||||
|
||||
attach_to_window() {
|
||||
NAME=$1
|
||||
HOST=$2
|
||||
WINDOW=$(get_window $NAME)
|
||||
if [ "$WINDOW" = "" ]
|
||||
then
|
||||
create_window $NAME
|
||||
tmux send-keys -t $NAME "jssh $HOST" C-m
|
||||
else
|
||||
tmux split-window -t $NAME
|
||||
tmux send-keys -t $NAME "jssh $HOST" C-m
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
tmux has-session -t $SESSION 2>/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
tmux new-session -d -s $SESSION
|
||||
for INSTANCE in $EC2_INSTANCES
|
||||
do
|
||||
HOST=$(echo $INSTANCE|cut -d',' -f1)
|
||||
NAME=$(echo $INSTANCE|cut -d',' -f2)
|
||||
attach_to_window $NAME $HOST
|
||||
done
|
||||
fi
|
||||
|
||||
tmux attach-session -t $SESSION
|
||||
|
||||
|
11
bin/pinentry
Executable file
11
bin/pinentry
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
PINENTRY_TERMINAL='/sbin/pinentry-curses'
|
||||
PINENTRY_VAYLAND='/sbin/pinentry-gtk-2'
|
||||
|
||||
if [ -n "${DISPLAY-}" -a -z "${TERM-}" ]; then
|
||||
exec "$PINENTRY_VAYLAND" "$@"
|
||||
else
|
||||
exec "$PINENTRY_TERMINAL" "$@"
|
||||
fi
|
5
bin/ss-keys.sh
Normal file
5
bin/ss-keys.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Adding T O O L B O X KEYS"
|
||||
ssh-add ~/Projects/streamsage.io/terraform-envs/toolbox/toolbox-swarm-ssh-key.pem
|
||||
|
Reference in New Issue
Block a user