Unsolved

Closed

1 Rookie

 • 

7 Posts

291

April 27th, 2023 02:00

Python script to shutdown Storage Array + UPS script

Hi community contributors,

Is there any pre-built Python script to remote shutdown ME5024 via ssh? or can we trust the script below?

 

import subprocess

# Set the IP address, username, and password for the storage array
ip_address = 'x.x.x.x'
username = 'admin'
password = 'password'

# Build the SSH command to connect to the storage array
ssh_cmd = f'sshpass -p {password} ssh -o StrictHostKeyChecking=no {admin}@{x.x.x.x}'

# Run the shutdown command on the storage array
cmd = f'echo y | {ssh_cmd} "shutdown both"'
result = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode != 0:
print('Failed to initiate shutdown')

# Close the SSH connection
subprocess.run(f'{ssh_cmd} "exit"')

Moderator

 • 

2.9K Posts

April 27th, 2023 07:00

Hi, unfortunately, I can't comment on that script. I found an article shows how to use the CLI to shut down a ME5024 array PowerVault ME5: Considerations when shutting down and moving an array to a new location | Dell Canada

However I'm not aware to automate this process. Might be our community members can help. It seems like there may be some risks, but I can't foresee potential risks. 

1 Rookie

 • 

7 Posts

April 27th, 2023 07:00

Many thanks.

I think so. Due to the fact that it is not recommended to enable the SSH service for a long time.

No Events found!

Top