Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # init
- ## VARIABLES REFERENCING LOCATION OF CONFIGURATION DATA ON THE SERVER
- HOST="iris@172.16.254.10" # Remote host
- HOSTPORT=65010
- SYSPATH="/share/SysConfig/"
- ## Restore local SSH host list
- SSHPATH="Config\\ Files/SSH/config"
- echo "Restoring local SSH host list"
- cd ~
- if [ ! -d ~/.ssh ]
- then
- mkdir ~/.ssh
- fi
- scp -P $HOSTPORT $HOST:"$SYSPATH/$HOSTNAME/$SSHPATH" /home/$USER/.ssh
- ## Restore Samba configuration
- echo "Restoring Samba configuration"
- cd /etc/samba
- FILE1=smb.conf
- if [ -f $FILE1 ];
- then
- sudo mv smb.conf smb.conf.old
- fi
- sudo scp -P $HOSTPORT $HOST:"$SYSPATH/$HOSTNAME/Config\\ Files/Samba/*" /etc/samba
- ## Restore local Bash scripts
- echo "Restoring Bash scripts"
- SCRIPTPATH="Bash\\ Scripts/"
- cd /usr/local/bin
- if [ -f /usr/local/bin/update ]
- then
- sudo rm *
- echo "FYI: Old bash scripts found. They have been deleted."
- fi
- sudo scp -P $HOSTPORT $HOST:"$SYSPATH/$HOSTNAME/$SCRIPTPATH/*" /usr/local/bin
- sudo chmod 755 *
- sudo chmod +x *
- cd ~
- ## Recreate crontab
- sudo scp -P $HOSTPORT $HOST:"$SYSPATH/$HOSTNAME/Config\ Files/Cron/root" /tmp/crontab
- sudo crontab /tmp/crontab
- sudo rm /tmp/crontab
- ## Restore connection with Pluto
- DESTINATION=Pluto
- echo "Setting up SSH connection to Pluto"
- read -p "Press enter until asked for a password." arg
- ssh-keygen
- ssh-copy-id -i ~/.ssh/id_rsa.pub $DESTINATION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement