LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-07-2004, 04:34 AM   #1
RX100
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


Hi,

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).

Thanxs

RX100
 
Old 10-07-2004, 02:59 PM   #2
tokyoeye
Member
 
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, 06:20 PM   #3
fenderman11111
Member
 
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:

Code:
#!/bin/bash

REMOTECPU=aaa.bbb.ccc.ddd
MYCPU=fff.ggg.hhh.kkk

app_name
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, 08:50 AM   #4
RX100
LQ Newbie
 
Registered: Oct 2004
Location: Belgium
Distribution: Fedora Core 2 kernel 2.6.5-1.358
Posts: 4

Original Poster
Rep: Reputation: 0
Hi,

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.

RX100
 
  


Reply



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 12:53 PM
problems with a global variable javier_ccs Programming 2 06-21-2005 12:18 PM
python global variable? goestin Programming 1 01-20-2005 06:52 AM
how to define a global variable Anniebaby Programming 1 11-09-2003 10:43 PM
How do I make SSH use the MAIL variable set by /etc/login.defs? RyanA Linux - Software 1 08-15-2003 11:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:00 PM.

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