I am basically trying to write a bash script that suspends some virtual machines running on a host. However, if I write the script sequentially, VMs will be suspended one at a time. Suspending a VM takes some time to save state. How can I let my script suspend the VMs concurrently. In other words, how can I run commands concurrently in a bash script instead of sequentially?
            Asked
            
        
        
            Active
            
        
            Viewed 2,322 times
        
    2 Answers
2
            
            
        You can background the tasks.
some bash command with options and stuff then with a &
Adding the & will send the command to the background and begin the next.
 
    
    
        EvilKittenLord
        
- 908
- 4
- 8
1
            
            
        Put a & after the command for suspending the the VM.
For example if
cmd_to_suspend_vm
was your command to run. You would run
cmd_to_suspend_vm &
 
    
    
        dostrander
        
- 737
- 5
- 19
