hawihoney Posted February 12, 2019 Share Posted February 12, 2019 Would please somebody so kind and check these two script sniplets? I want to coordinate the Start and Stop of VMs and Dockers within a Start and Stop script. Is this how it should be done? Am I using the correct syntax and command options? Anything else I need to take into account? I'm running additional Unraid arrays each in it's own VM. So the VMs need to be started first, I want to wait some time for them to complete. After that I want to create the required mount points and after that I want to start a docker. Both scripts are User Scripts and applied to array start/stop. May thanks in advance. #!/bin/bash # Start both VMs first virsh start TowerVM01 virsh start TowerVM02 # Wait some time sleep 5m # Create base Mount Point mkdir -p /mnt/hawi # Create Mount Points for first VM mkdir -p /mnt/hawi/192.168.178.101_disk1 # ... # Create Mount Points for second VM mkdir -p /mnt/hawi/192.168.178.102_disk1 # ... # Mount Shares of first VM mount -t cifs -o rw,nounix,iocharset=utf8,_netdev,file_mode=0777,dir_mode=0777,vers=3.0,username=hawi,password=****** '//192.168.178.101/disk1' '/mnt/hawi/192.168.178.101_disk1' # ... # Mount Shares of second VM # mount -t cifs -o rw,nounix,iocharset=utf8,_netdev,file_mode=0777,dir_mode=0777,vers=3.0,username=hawi,password=****** '//192.168.178.102/disk1' '/mnt/hawi/192.168.178.102_disk1' # Start Docker docker start plex #!/bin/bash # Stop Docker docker stop plex # Unmount Shares of second VM umount -l '/mnt/hawi/192.168.178.102_disk7' # ... # Unmount Shares of first VM umount -l '/mnt/hawi/192.168.178.101_disk21' # ... # Remove Mount Points to second VM rmdir '/mnt/hawi/192.168.178.102_disk7' # ... # Remove Mount Points to first VM rmdir '/mnt/hawi/192.168.178.101_disk21' # ... # Remove base Mount Point rmdir '/mnt/hawi' # Stop VMs virsh shutdown TowerVM02 virsh shutdown TowerVM01 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.