
UNSOLVED
Closed
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"')
Responses (2)
Solutions (0)

DELL-Erman O
Moderator
•
2984 Posts
•
14874 Points
155
0
Posted 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.
DELL-Erman O
Social Media and Communities Professional
Dell Technologies | Enterprise Support Services
#IWork4Dell
Did I answer your query? Please click on ‘Mark as Accepted Answer’. ‘Thumbs up’ the posts you like!