[mrtg] Re: Accessing Shell Variables in Template
Fruitman, Corey
Corey.Fruitman at allstream.com
Wed Mar 17 21:47:39 MET 2004
You have a shell script that assigns a value to the variable "CPU" then you want to pass the value of that variable to cfgmaker, right? Just put a dollar sign ($) before your variable name in the script and the shell will substitute it with the value.
This doesn't have anything to do with Perl (or MRTG).
Let's assume you want to use bash as your shell. Try this:
#!/bin/bash
CPU=4
/path/to/cfgmaker --host-template=$CPU.tmpl [...]
Your template will have to be named "4.tmpl" and be located in the same directory as where you're executing cfgmaker.
Should do the trick. Hope that helps,
Corey.
-----Original Message-----
From: mrtg-bounce at list.ee.ethz.ch [mailto:mrtg-bounce at list.ee.ethz.ch]On
Behalf Of Thomas.Rupp at illwerke.at
Sent: March 17, 2004 2:47 PM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] Accessing Shell Variables in Template
Hi MRTG-gurus,
I try to create different config files using --host-template
depending on the number of CPUs a server has.
I have the following shell script
CPU = 4
cfgmaker --host-template=...
What do I have to do to access the Variable CPU in the template?
I know absolutely nothing about Perl so would be very grateful for
any help
Thanks in advance
Thomas Rupp
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list