Men & Mice Men & Mice Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
A simple Ruby snippet to write the XML data recieved from Men & Mice Central to a file  XML
Forum Index -> Scripting and Customizing
Author Message
Carsten Strotmann
Men & Mice Staff
[Avatar]

Joined: 26/07/2007 13:08:39
Messages: 159
Location: Germany
Offline

Here is a small snippet that saves the data recieved from Men & Mice Central into a XML file. The Script must be executable and must be listed in the Men & Mice GUI Console "System Settings -> External Commands":

Code:
 #!/usr/bin/ruby
 # (c) 2009-2010 by Men & Mice
 # 2010.07.01 Carsten Strotmann
 
 debugf = File.open("/tmp/mmcentral-data.xml", "w")
 
 xmls = ""
 while line = $stdin.gets  
   xmls = xmls + line
   debugf.puts line
 end
 
 debugf.close
 

----
Men & Mice Support Team
support@menandmice.com
Carsten Strotmann
Men & Mice Staff
[Avatar]

Joined: 26/07/2007 13:08:39
Messages: 159
Location: Germany
Offline

Cliff Cogdill did a Perl version of the above Ruby snipped:

Code:
 #!/usr/bin/perl
 
 # Name: genXML.pl
 # Author: Cliff Cogdill
 # Date: 2010.07.08
 # Purpose: This script will output an XML file of the data received from Men and Mice Central. In
 #                  order to make this work, it must be placed in the "External Commands" section of the
 #                  Men and Mice management console, which is only available to the Administrative user.
 
 my $xmlLine, $outFile;
 
 $outFile = "/opt/mms/scripts/central.xml";
 $xmlLine = "";
 
 # Create the output filehandle
 open(OUT, ">$outFile") || die "Could not open " . $outFile;
 
 # Read the input from STDIN and write it to the output file
 while (<STDIN>) {
         $xmlLine = $_;
         print OUT $xmlLine . "\n";
 }
 
 # Close the output filehandle
 close OUT;
 

----
Men & Mice Support Team
support@menandmice.com
 
Forum Index -> Scripting and Customizing
Go to:   
Powered by JForum 2.1.7 © JForum Team