Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Environment Variables Declaration

Posted on 1999-07-09
7
Medium Priority
?
289 Views
Last Modified: 2013-12-15
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.
0
Comment
Question by:diogoschneider
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1629388
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.
0
 
LVL 1

Author Comment

by:diogoschneider
ID: 1629389
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.
0
 
LVL 1

Author Comment

by:diogoschneider
ID: 1629390
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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 1629391
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.
0
 
LVL 1

Author Comment

by:diogoschneider
ID: 1629392
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.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 200 total points
ID: 1629393
see comments
0
 
LVL 1

Author Comment

by:diogoschneider
ID: 1629394
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question