Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-07-2004, 05:34 AM   #1
LQ Newbie
Registered: Oct 2004
Location: Belgium
Distribution: Fedora Core 2 kernel 2.6.5-1.358
Posts: 4

Rep: Reputation: 0
Set Global variable for daemon without login


I have an application running under Fedora Core 2.
This application is designed to communicate with another platform.
To run properly, this application needs several global variables to be set (IP address of destination platform).
My variable has the form
REMOTECPU=aaa.bbb.ccc.ddd (IP address)
MYCPU=aaa.bbb.ccc.ddd (IP address)

When I logon, set the global variables and start the application, everything runs fine.

For security reasons and to have it always ready (i.e. after a power failure), I would like the application start automatically at Linux boot WITHOUT having to logon.

I found how to start my daemon automatically (putting my application in /etc/rc.local) and it starts, but id does not communicate with my REMOTECPU because the global variables are not set.

I also tried to set my variables into /etc/bashrc and when I logon, the application works fine. BUT I have to logon and I do not want to do that.

Does someone out there have a solution to my problem (set global variables WITHOUT logging).


Old 10-07-2004, 03:59 PM   #2
Registered: Oct 2003
Location: Amsterdam
Distribution: gentoo,debian
Posts: 47

Rep: Reputation: 15
bashrc is only started when the bash shell is started, and this only happens when a user who uses the bash shell logs in (defined in the passwd file)

isn't there a way to set these cpu settings in the application itself?
Old 10-07-2004, 07:20 PM   #3
Registered: Jun 2004
Location: Denton
Distribution: debian, freebsd
Posts: 121

Rep: Reputation: 15
I think i get what you're saying ... here's what you do: just write a bash script that runs your program and sets your variables and then put it in rc.local.

if you don't know how to do this, it's quite simple

make a file like this:



make that file and name it whatever, then save that in rc.local...

then do a "chmod 755 file_name" to make it executable.
Old 10-08-2004, 09:50 AM   #4
LQ Newbie
Registered: Oct 2004
Location: Belgium
Distribution: Fedora Core 2 kernel 2.6.5-1.358
Posts: 4

Original Poster
Rep: Reputation: 0

I created the /etc/rc.local with the settings of the variables and the start of the application in it and it does want I want (be operational without having to logon).

With accurate help like this coming at speed of light, you can jump into Linux with no fear.

Thanx a lot.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Python Global Variable? ElementNine Programming 5 11-05-2007 01:53 PM
problems with a global variable javier_ccs Programming 2 06-21-2005 01:18 PM
python global variable? goestin Programming 1 01-20-2005 07:52 AM
how to define a global variable Anniebaby Programming 1 11-09-2003 11:43 PM
How do I make SSH use the MAIL variable set by /etc/login.defs? RyanA Linux - Software 1 08-15-2003 12:03 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:40 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration