Help needed with bash script providing battery status

I'm really new to even doing a bash "hello world" script, so maybe someone would know how to do the following task, using bash scripting

Need to login using ssh from one dell server into another dell server, and obtain the raid battery status, using dell's open manage software commands; then provide those results back to the first server

Thanks so much in advance!
-AJ

:wall:

The answer for how to do that with ssh is very similar to the answer for how to do that without ssh. What exactly do you need to put into openmanage?

1 Like

so I tried on my own from some bash tutorials, but all my script does is log me into the remote server and kicks me back to the orig server

here's what i have, still not sure if bash scripting is as simple as DOS batch files or if it involves a bit more

su9 ssh [IP]
omreport storage battery >> [path to the text file on orig server]
logout

seems as though the ssh session kicks me out without even issuing the logout command, so i'm losing the ssh connection somehow also, possibly even before the omreport command runs

any additional help is welcomed!

I don't know what that "su9" is supposed to do.

ssh doesn't work like that. It tries to run the 'ssh' command locally, waits for it to finish, then tries to run the 'omreport' command locally because you didn't feed the following things into ssh. To feed commands into ssh, you must feed them into ssh. There's several ways to do that.

To run one command on the remote server:

ssh username@host command

It will run that command then immediately return.

ssh username@host <<EOF
command1
command2
command3
EOF

It will run the shell script given between <<EOF and EOF.

1 Like

those ideas should help me get on the right track, thank you so much!

oh and su9 is the command we use to login to a server as the root user without needing a password each time

You do not need root to run ssh.

If you need it to run the battery command, run it on the remote side, not the local one.

1 Like