Diky vsem. Vzal jsem skript co tu byl a poupravil k obrazu svemu.
# !/bin/bash
# The script needs these command installed on your system:
# bash, ssh, scp, sshpass
# ./mkKomplet.sh user password config firmware ip
username=$1
password=$2
CONF=$3
MkUpdate=$4
IPADDR=$5
jmeno=$(sshpass -p $password ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -n $username@$IPADDR ":put [/system identity get name]" | sed 's/.$//')
echo "Ukladam konfiguraci z $jmeno @ $IPADDR"
sshpass -p $password ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -n $username@$IPADDR "/export file=export"
sshpass -p $password scp -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $username@$IPADDR:/export.rsc backups/$jmeno@$IPADDR.rsc
echo "Nahravam Firmware na $IPADDR fw $MkUpdate "
sshpass -p $password scp -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $MkUpdate $username@$IPADDR:/$MkUpdate
echo "Nahravam konfiguraci $CONF"
sshpass -p $password scp -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $CONF $username@$IPADDR:/$CONF
echo "Upgrade FW "
sshpass -p $password ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -n $username@$IPADDR "/system routerboard upgrade"
echo "Spoustim Konfiguraci $CONF"
sshpass -p $password ssh -q -o StrictHostKeyChecking=no -o ServerAliveInterval=2 -o UserKnownHostsFile=/dev/null -n $username@$IPADDR "/import file=$CONF;:delay 5s;/file remove \"$CONF\";/system reboot"
echo " "
echo "!!! Reboot !!!"