Link to home
Start Free TrialLog in
Avatar of diogoschneider
diogoschneider

asked on

Environment Variables Declaration

I've got a problem.

 My '/etc/rc.d/rc.inet2' file checks for the existence of files before running them, in example:

if [ -f ${NET}/named ];then
  echo -n " named"
  ${NET}/named -u daemon -g daemon
fi

but it's not working... named, among other daemons called the same way aren't being started during boot-up. And when I type 'echo ${NET}' there's actually no response.

 When I type 'declare', no '${NET}' variable is displayed.

 Then I would:

cd /etc/rc.d
grep declare *

trying to find out how environment variables are declared on boot-up, but I couldn't...

 Does anybody know where are environment variables declared on boot-up? Or at least if there's another problem. I would just replace every '${NET}' by '/usr/sbin' on my '/etc/rc.d/rc.inet2' file, but that's not my style...

 PS: Sorry for the points, but I'm running out of them lately...

 []'s,

 Diogo.
Avatar of ahoffmann
ahoffmann
Flag of Germany image

at the beginning of /etc/rc.d/rc.inet2 there will be a line where another scriped is sourced, like:
  . /etc/rc.config    # or similar
check this file if there if it has a line like=
   NET=/usr/sbin
You also may check where /etc/rc.d/rc.inet2
will be called, probably from /etc/rc.boot, same check (as described above) to be done there.
Avatar of diogoschneider
diogoschneider

ASKER

It's called from '/etc/rc.d/rc.M', but as I've done a 'grep {NET} *' on the '/etc/rc.d' directory before it couldn't be there.

 Well, I foud a solution for the problem, by replacing '${NET}' by '/usr/sbin/'. I guess the people at Slackware forgot to export such variable. I'll post thids bug on their forum, also.

 But I'm still wondering... Where and how should environment variables be set on Linux as a standard? I mean... Where Torvalds would look for them? 8)

 []'s,

 Diogo.
It's called from '/etc/rc.d/rc.M', but as I've done a 'grep {NET} *' on the '/etc/rc.d' directory before it couldn't be there.

 Well, I foud a solution for the problem, by replacing '${NET}' by '/usr/sbin/'. I guess the people at Slackware forgot to export such variable. I'll post thids bug on their forum, also.

 But I'm still wondering... Where and how should environment variables be set on Linux as a standard? I mean... Where Torvalds would look for them? 8)

 []'s,

 Diogo.
you grep would not find the setting, probably just the usage.
I said search (grep) for   NET  not   {NET}

Could you please post this script.
I've solved the problem... The variable is actually set on the beginning of the script... It's just that I didn't pay attention to the section named is called, it was commented. Guess I've been to much time working on this and couldn't see the most obvious reason for the problem...

 Well, thanks for your time... Just give an answer to the question and I'll give you the points...

 []'s,

 Diogo.
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The script I ended up with is excellent: I've been testing it and there's no way my connection won't be on-line in one minute if something happens... 8)

Here is it:

#!/bin/bash
while [ -x /etc/rc.d/rc.ppp ]; do
  if [ ! -f /var/run/ppp0.pid ]; then
    /usr/sbin/pppd lcp-echo-interval 10 lcp-echo-failure 12 crtscts lock passive asyncmap 0 defaultroute /dev/ttyS1 115200
  fi
  sleep 60
done
#End of file.