In Solaris (I know… another Solaris question…) it is possible to install a scripting program that allows you to look for specific output from a system, and then send specific responses back to that system. One example would be logging into a system with a password, that can be sent by this script.
I was wondering if there is something like that built into Action scripts? I’d prefer not to install the package on all of the Solaris machines if there was a way to use this ability with IEM.
The actionscript language doesn’t deal well with the standard console in/out type streams etc (stdout/stderr etc). You can do this probably within some other package like you mentioned but there isn’t any native item there. I presume the shells you use can’t even do this natively?
You can run any command through IEM, output the results to a file, then read that file using relevance… This seems a bit like what you are trying to do.
Depending on what you are trying to do, you might be able to query the results directly through relevance.
I am quite certain that it should be possible to do this using BigFix/IEM.
I don’t have any way of testing this, but if there is a way to do this on a single line, then that would be an option. Something like this:
wait sh -c "echo "{parameter "password"}$'\n'{parameter "password"}$'\n'" | /usr/sbin/eeprom security-mode=command"
The only other option would be to run an actual script that would do this, which might not need to use expect. You could write relevance to look for expect so that you would only try to run the version using expect on systems that have it, and do it differently without using expect on machines that lack it.
Unfortunately, this doesn’t work. I tried several combinations of quotes and no luck. I believe that was part of the reason why expect was created to begin with. For situations like this…
You could just run the script that uses expect on the systems that have expect. On systems that do not have expect, you could download a copy of expect for that system and use it on the fly.
Also, I think my previous attempt was using the wrong end of line character:
wait sh -c "echo "{parameter "password"}$'\r'{parameter "password"}$'\r'" | /usr/sbin/eeprom security-mode=command"
These are all things you should try to get to work using a single line on the command line first before attempting to automate through BigFix/IEM because it will take many attempts to figure out the correct syntax, if it is possible at all.
You definitely can do this through BigFix/IEM by creating a bash script using the create file command and then running it, but it would either need to use expect or that alternative script I linked above.
The security-password text is ignored, because user is already prompted for password when you use:
/usr/sbin/eeprom security-mode=command
Trying to use the expect type shell script, the prompts for New password: and Retype new password: are getting sent to the console, not the file1 file, so the E lines aren’t finding the expected text…
Thanks for all your effort in trying to figure this out. It looks like the only way to go with this is to have expect loaded on each machine. I would have much preferred using a solution that could be housed completely on IEM.
I find it odd that there isn’t a solution for this somewhere. This isn’t so much a limitation of BigFix/IEM as it is a limitation of the ability to script eeprom security-mode=command non-interactively. If there was a way to do this using a shell script without using expect, then that should also work in BigFix/IEM. Same goes if there is a way to do it with a single line.
I don’t have a system that uses this command, so I don’t have any experience with it or a way to experiment.
You don’t need to load expect on each machine ahead of time. You can download expect and use it only on the machines that do not have it already, and the machines that do have it already can just use the existing copy. You can do this in a prefetch block.
This is basically how I do installs that require unzip.exe without requiring it be on the system in the first place.