Advertisement
Guest User

Setup Script

a guest
Aug 16th, 2012
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.37 KB | None | 0 0
  1. #!/bin/bash
  2. # init
  3.  
  4. ## VARIABLES REFERENCING LOCATION OF CONFIGURATION DATA ON THE SERVER
  5. HOST="iris@172.16.254.10" # Remote host
  6. HOSTPORT=65010
  7. SYSPATH="/share/SysConfig/"
  8.  
  9.  
  10. ## Restore local SSH host list
  11. SSHPATH="Config\\ Files/SSH/config"
  12. echo "Restoring local SSH host list"
  13. cd ~
  14.   if [ ! -d ~/.ssh ]
  15.   then
  16.     mkdir ~/.ssh
  17.   fi
  18. scp -P $HOSTPORT $HOST:"$SYSPATH/$HOSTNAME/$SSHPATH" /home/$USER/.ssh
  19.  
  20.  
  21. ## Restore Samba configuration
  22. echo "Restoring Samba configuration"
  23. cd /etc/samba
  24. FILE1=smb.conf
  25. if [ -f $FILE1 ];
  26. then
  27.   sudo mv smb.conf smb.conf.old
  28. fi
  29. sudo scp -P $HOSTPORT $HOST:"$SYSPATH/$HOSTNAME/Config\\ Files/Samba/*" /etc/samba
  30.  
  31.  
  32. ## Restore local Bash scripts
  33. echo "Restoring Bash scripts"
  34. SCRIPTPATH="Bash\\ Scripts/"
  35. cd /usr/local/bin
  36. if [ -f /usr/local/bin/update ]
  37. then
  38.   sudo rm *
  39.   echo "FYI: Old bash scripts found. They have been deleted."
  40. fi
  41. sudo scp -P $HOSTPORT $HOST:"$SYSPATH/$HOSTNAME/$SCRIPTPATH/*" /usr/local/bin
  42. sudo chmod 755 *
  43. sudo chmod +x *
  44. cd ~
  45.  
  46.  
  47. ## Recreate crontab
  48. sudo scp -P $HOSTPORT $HOST:"$SYSPATH/$HOSTNAME/Config\ Files/Cron/root" /tmp/crontab
  49. sudo crontab /tmp/crontab
  50. sudo rm /tmp/crontab
  51.  
  52.  
  53. ## Restore connection with Pluto
  54. DESTINATION=Pluto
  55. echo "Setting up SSH connection to Pluto"
  56. read -p "Press enter until asked for a password." arg
  57. ssh-keygen
  58. ssh-copy-id -i ~/.ssh/id_rsa.pub $DESTINATION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement