aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/scripts/AN2Linux.sh
blob: 263f93201945e0011146f71cbd5cde1033444876 (plain)
1
2
3
4
5
6
7
8
9
#!/bin/bash

if [[ $1 && $2 && $3 ]];then
 ssh-add -l |grep -q `ssh-keygen -lf $1  | awk '{print $2}'` || ssh-add $1
 ssh root@$2 "/root/AN2Linux.sh start $(\ip addr show $3 | grep "inet " | cut -d'/' -f1 | awk '{print $2}')"; an2linuxserver.py; ssh root@$2 "/root/AN2Linux.sh stop $(\ip addr show $3 | grep "inet " | cut -d'/' -f1 | awk '{print $2}')";
else
    echo "Usage:"
    echo " $0 <ssh_key> <ip_server> <interface>"
fi