Script for VIOS

Hello, I'm having troubles running scripts on the VIOS. I want to run a simple script like:

lsmap -all | grep vhost

I've created the file with just like this:

$ cat script1.sh
lsmap -all | grep vhost

When I run the script, it returns the following error message:

script1.sh: lsmap: not found

Any suggestions?

Thanks

Enzote

Have a look at the environment inside your script. Something like:

#! /bin/ksh
print - "$PATH"
lsmap all | grep vhost

Compare that with the output of 'print - "$PATH"' on the commandline. Anything different?

I hope this helps.

bakunin

/usr/ios/cli/ioscli lsmap

You can run padmin commands from the root shell (oem_setup_env) with the same ioscli. I find it easier to just be root and write my scripts using that path.

bakunin:
I've added those lines at the top of my script but, unfortunately, it doesn't work. The same error remains.

Airborne:
Your suggestion works just fine! I'll do my scripts on oem_setup_env and that path.

Thanks!

instead of scripting that, just make an alias

$ alias vh='ioscli lsmap -all|grep vhost'

don't use oem_setup_env unless you need to, you are asking for a whole world of pain when it goes wrong.
and who wants a system with a broken vio server.
read the docs, if you cannot work it out as padmin call IBM.
if you don't have support - good luck.
if you do have support and they say use padmin and either help you find an answer or say there is no answer then at least you can get some help on a sunday evening when your vio goes down.
serously, there are too many unknowns using root on vios for things that are not documented as being supported.