Use > Server Automation > SA Global Shell > Global Shell examples > Running OGFS scripts on managed servers with rosh

Running OGFS scripts on managed servers with rosh

The next sequence of commands create a .BAT script in the OGFS and then run the script on a Windows managed server. Created with echo statements, the myfile.bat script resides in the OGFS under /home/jdoe/public/bin. (Note that myfile.bat does not reside in the file system of the managed server.) The myfile.bat script contains three commands: ipconfig, cd, and dir. The rosh command runs myfile.bat on the server named abc.opsware.com as the Administrator Windows user. The following commands create a local .BAT script and run it remotely with rosh:

cd /home/jdoe/public/bin
 
echo ipconfig > myfile.bat
echo "cd c:\temp" >> myfile.bat
echo dir >> myfile.bat
 
rosh -n abc.opsware.com -l Administrator -s ./myfile.bat

 

Create a script named who.sh in the /home/jdoe/public/bin directory of the OGFS and then run who.sh on the server named m256.opsware.com:

cd /home/jdoe/public/bin
 
echo \#\!\/bin\/sh > who.sh
echo "uname -n" >> who.sh
echo id >> who.sh
echo pwd >> who.sh
 
rosh -n m256.opsware.com -l root -s ./who.sh