Running Magnet
Command Line
The Magnet distribution comes with startup scripts to run Magnet from the command line. Under the /bin directory of the distribution you will find a 'magnet.bat' for Windows and a 'magnet.sh' for Unix/Linux operating systems.
The installation procedure is as follows:
- Extract the Magnet distribution in the directory of your choice.
- Define the environment variable MAGNET_HOME that points to the installation directory.
- Add the directory $MAGNET_HOME/bin to the PATH environment variable.
Online Help
You can call magnet and pass the -help (or -h) option to see a the usage information. Here is what it looks like:
Usage: magnet [vm options...] [options...] [args...]
VM Options:
Options that affect the Java VM that will be started. The Vm options
can be one or many of the following:
-javahome <path>
to define the home of the java runtime this option overrides
the JAVA_HOME environement variable
-client to start java with the 'client' VM
-server to start java with the 'server' VM
-X<option>
to start java with non-standard options
-D<name>=<value>
to set a system property
Options:
Options that will define the behavior of the magnet runtime on the Java
VM is started. The magnet options can be one or more of the following:
-help | -h
print this message
-version
print the version information and exit
-logfile | -log <file>
use the given file to log
-debug print debugging information
-info print information that can help to diagnose
-warn print warning and error information
-file | -f <file>
use the given magnet configuration file
-profile | -p <name>
the name of the profile to execute in the magnet. If the profile
is not provided, only the launchers with a default profile are
executed.
Args:
The application arguments that can be passed to magnet at every execution.
Each argument will be assigned to a system property of the name magnet.args.n
where the 'n' is replaced by the number of the argument in the list. The
additionnal system property magnet.args.* contains the entire list of arguments
as a whole String.
Examples:
To start a server VM that will run the magnet TimeServer.xml using the test profile:
magnet -server -file TimeServer.xml -profile test
To start a VM using an alternate java home:
magnet -javahome /opt/jdk1.4 -file TimeServer.xml -profile test
To start a VM with specific memory setting and a VM argument:
magnet -Xms8m -Xmx256m -Dfoo=bar -f TransactionServer.xml -p prod
To run a magnet file to which application arguments '10', '50' and '125' are passed:
magnet -f MetricConversion.xml -p weight 10 50 125