Koozali.org: home of the SME Server

e-smith variables list

gabriel

e-smith variables list
« on: January 11, 2002, 05:23:54 AM »
Hi

Anybody have or know how I can get a list of e-smith variables (like
$DOMAIN, $IPADDRESS, etc) and It description?

Thanks, Gabriel

Nobody

Re: e-smith variables list
« Reply #1 on: January 11, 2002, 07:33:17 AM »
Here is one way - I'm sure that Charlie B won't like it, but that's ok :-)

#!/bin/sh
#
# Get Variables and Print them out
# This script is public domain / freeware (if anybody cares??)
#
# If you just want to print out the information:
#
/sbin/e-smith/db configuration show ExternalIP | sed 's/^.*=//'
/sbin/e-smith/db configuration show LocalIP | sed 's/^.*=//'
/sbin/e-smith/db configuration show GatewayIP | sed 's/^.*=//'
/sbin/e-smith/db configuration show ExternalNetmask | sed 's/^.*=//'

# If you want to store the information in a variable to use later:
SRV=/sbin/e-smith/db configuration show SambaServerName | sed 's/^.*=//'
echo "The name of your server is: $SRV.  How about that?"


The output looks like this:

35.28.234.54
192.168.1.1
192.168.65.1
255.255.255.0
The name of your server is: apollo.  How about that?


And to get a list of variables:

cat /home/e-smith/configuration | more


I don't know, like I said this is just a start and I'm sure someone will bitch about it.

Nobody

Re: e-smith variables list
« Reply #2 on: January 11, 2002, 08:08:54 AM »
I figured out another way (at least to get IP's, subnet's etc.) and this one will work on most linux systems like RedHat, etc.

#!/bin/sh
#
# Prints out internal / external IP
# This script is public domain / freeware (if anybody cares??)
#
INT=ifconfig eth0 | grep "inet" | awk '{ print $1,$2 ; }' | sed 's/^inet addr://'
EXT=ifconfig eth1 | grep "inet" | awk '{ print $1,$2 ; }' | sed 's/^inet addr://'
echo " "
echo "Your internal address is: $INT"
echo "Your external address is: $EXT"
echo " "

The output:
 
Your internal address is: 192.168.1.1
Your external address is: 35.23.52.42

If this is for a configuration file, then you will have to make templates and break up your scripts.  Take a look in /etc/e-smith/templates/ for more detail.

Nobody

Re: e-smith variables list
« Reply #3 on: January 11, 2002, 09:30:57 AM »
And if you want to use e-smith templates:

in /etc/e-smith/templates or /etc/e-smith/templates-custom

just enter:

in a folder called the name of your file... eg.

if /etc/empty.conf is the name of your configuration file for a program or something then you must create a directory.

mkdir -p /etc/e-smith/templates-custom/etc/empty.conf

cd /etc/e-smith/templates-custom/etc/empty.conf

vi 10template

Domain={$DomainName}
Workgroup={$SambaWorkgroup}
External IP={$ExternalIP}
Local Netmask={$LocalNetmask}

save your work  (:wq!)

In order to "pull" variables into your new file /etc/empty.conf you must:

/sbin/e-smith/expand-template /etc/empty.conf

presto, you just created a file with valuable information.  I just figured all this out tonight... :-)

You can also add your own variables to the /home/e-smith/configuration file if you want to... and be able to pull them later.

/sbin/e-smith/db configuration set MyVariable johnsmith

Now you can "pull" MyVariable (which is current johnsmith) into your templates.

gabriel

Re: e-smith variables list
« Reply #4 on: January 11, 2002, 06:11:02 PM »
Ok! thanks to...   nobody?  :-)

Thank you a lot, your explanation was a very very good begin with this stuff.
But... (oh! what he want now?) I can“t find the virtual domains name data... where is stored?
I want to automate the IP refresh for dyndns.org at /sbin/e-smith/dynamic-dns/dyndns.org  on all my existing and future virtual domains.   (a hard target to my first Perl program?, I am tired to begin with the old "hello world" :-))    ).

Cheers, Gabriel

Nobody

Re: e-smith variables list
« Reply #5 on: January 11, 2002, 06:31:46 PM »
These are all good questions for the development group.  It sounds like you are ready for that.

Sign up:

http://www.e-smith.org/content/developers/

And start asking away.

Des Dougan

Re: e-smith variables list
« Reply #6 on: January 11, 2002, 06:38:58 PM »
Nobody wrote:
>
> These are all good questions for the development group.  It
> sounds like you are ready for that.

No, these are questions for the Experienced Users forum. The devinfo list is for development issues - not for asking questions that (in a lot of cases) can be answered by searching the archives.

Des Dougan

Nobody

Re: e-smith variables list
« Reply #7 on: January 11, 2002, 07:24:20 PM »
These sound a lot like development questions, Des.

An experienced question would be something like...
"I have a Windows 2000 server and I would like it to be a BDC for my SME5 server.  How can this be accomplished."

A development question is...
"I am building an RPM that installs custom templates, actions and a webpanel.  But I need the "x" variable in order to make it work.  What command can I use to do this because this SME/E-smith system is very confusing to new programmers..."

So, Des... why don't you answer his question instead of telling him what not to do?

Des Dougan

Re: e-smith variables list
« Reply #8 on: January 12, 2002, 06:32:21 AM »
Nobody wrote:
>
> These sound a lot like development questions, Des.
>

I disagree. Gabriel is looking for help with setting up dyndns. This is a regular question on these forums and a search will likely pull up a number of answers which might help. I don't use dyndns so can't provide specific answers.

Devinfo is specifically for discussion on extending SME, not on "how do I do this" questions. My intention was to save Gabriel a wasted trip, not to discourage him.


Des Dougan