I am trying to make a formulascript that will, among other things, get a
status.dat file from nagios servers using scp to copy it to the NOC
server (both are linux servers). I wrote a quick bash script that
accepts the nagios server name as a parameter, and it looks like this:

#Prints the user's name
echo "Hello $USER"\
#Sets the parameter passed by the user as SERVERNAME
#Prints the parameter passed by the user
#Runs the scp command to copy the file from the Nagios server to
the NOC server
scp -P 22222 nuser@$SERVERNAME:/var/log/nagios/status.dat

I have tested this script and it works, but the challenge I am now
facing is calling this script from a for loop in the formulascript.
I would like to call the bash script in the formulascript, at the
beginning of this for loop (where the ??????? are located):

for( var i = 0; i < servers.length; i++ ){
var synced = setup.SyncStatusFile( configData, servers[i],
"/opt/ManagedObjects/" );
if( synced == false ){
throw "Could not sync status file.";
// cannot sync a nagios file. continue on, but log the
//var now = new java.util.Date();
//var str = now.getDate() + "-"
+now.getDay()+"-"+now.getFullYear()+" " +now.getHours() +":" +
log.logPrint( str + " Could not sync status file for: "
+ servers[i] );
var nagios = new NagiosSync(configData, servers[i]);

This seems like it should be easy, and I have googled it and tried a
couple of this, but I am not sure how to call the bash script in the
formula script.
I tried something like:
java.lang.Runtime.getRuntime().exec("cmd /c start cmd.exe /K

jeffcroskrey's Profile: https://forums.netiq.com/member.php?userid=2905
View this thread: https://forums.netiq.com/showthread.php?t=46259