Skip to content

Latest commit

 

History

History

HARDWARE

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

VM Shutdown Script

This script shuts down a list of virtual machines (VMs) and powers off the host machine.

Usage

1. Elevate Privileges

Before running the script, ensure you are operating as the root user. You can either:

  • Switch to the root user:

    su -
  • Or use sudo -i to start a root shell:

    sudo -i

2. Execute the Script

Once you have elevated privileges, run the script using bash:

bash shutdown.sh

3. Dry Run Mode

To simulate the shutdown without making any changes:

bash shutdown.sh -d

VM List

The script will shut down the following VMs by default:

  • dc1
  • idm
  • idm2
  • nessus
  • dc2

You can modify this list in the script under the VM_names array.

Troubleshooting

Fixing Syntax Errors (Line Endings)

If you receive a syntax error like ^M: bad interpreter, it could be due to Windows-style line endings. Use dos2unix to convert the script:

dos2unix shutdown.sh