| 1 | #!/bin/bash
 | 
  
    | 2 | 
 | 
  
    | 3 | myNic="$(ls /sys/class/net/ -1 | grep -v lo | grep -v wlan)"
 | 
  
    | 4 | 
 | 
  
    | 5 | if [ -e /root/reboot ];then
 | 
  
    | 6 |     rm /root/reboot
 | 
  
    | 7 |     touch /root/join
 | 
  
    | 8 |     shutdown -r now
 | 
  
    | 9 | fi
 | 
  
    | 10 | 
 | 
  
    | 11 | 
 | 
  
    | 12 | if [ -e /root/cluster ];then
 | 
  
    | 13 |     clusterJoin="$(cat /root/cluster)"
 | 
  
    | 14 | fi
 | 
  
    | 15 | 
 | 
  
    | 16 | 
 | 
  
    | 17 | if [ -e /root/join ];then
 | 
  
    | 18 | # Following dhclient was necessary inside a virtual(box) environment. Not sure if needed anymore. In case it can be removed or commented.    
 | 
  
    | 19 |     dhclient $myNic
 | 
  
    | 20 |     screen -d -m -S XY
 | 
  
    | 21 |     screen -S XY -X stuff "fuss-client -av $clusterJoin && rm /root/join ; reboot\n"
 | 
  
    | 22 | else
 | 
  
    | 23 |     rm /etc/rc.local
 | 
  
    | 24 |     rm /root/clientScript
 | 
  
    | 25 |     rm -fr /root/.ssh
 | 
  
    | 26 |     rm /root/cluster
 | 
  
    | 27 | fi
 | 
  
    | 28 | 
 | 
  
    | 29 | 
 | 
  
    | 30 | 
 | 
  
    | 31 | 
 | 
  
    | 32 | 
 |