LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-25-2004, 07:11 PM   #1
luwigie
Member
 
Registered: Aug 2004
Location: Michigan, USA
Distribution: Fedora Core 2
Posts: 42

Rep: Reputation: 15
How can I run a command automatically at startup?


I want to start up my bandwidth monitoring programs (ntop and vnstat) on startup. I am running a server with FC2 in init mode 3 because the machine is old and I don't want to slow it down by running a GUI. Is there a way that I can do this? If so, do I just enter in the commands in a file like I would on the command line? Where does the output go? What user would run it?

Thanks!
 
Old 08-25-2004, 08:05 PM   #2
Peacedog
Guru
 
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,292

Rep: Reputation: 167Reputation: 167
this may answer your ?

http://www.redhat.com/docs/manuals/l...-services.html

hope that helps.
good luck.
 
Old 08-25-2004, 11:35 PM   #3
luwigie
Member
 
Registered: Aug 2004
Location: Michigan, USA
Distribution: Fedora Core 2
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks for the reply, but that's not quite what I was looking for. I think that there is a file that gets run once everything else is loaded where you can put custom commands. Am I correct, any one?
 
Old 08-26-2004, 12:52 AM   #4
realjustin
Member
 
Registered: Aug 2004
Location: /dev/null
Distribution: Slack 10, Debian
Posts: 99

Rep: Reputation: 15
It is called rc.local
It could be in various places, I'm not sure where in FC2. Probably
/etc/rc.d/rc.local
or someplace similar. Beware it gets run as root.
 
Old 08-26-2004, 03:21 AM   #5
myriad-zero
Member
 
Registered: Aug 2004
Location: /india/tn/chennai
Distribution: Debian
Posts: 38

Rep: Reputation: 15
Exactly that is the place to put in. Make sure that you don't screw up anything else.
 
Old 08-26-2004, 07:35 AM   #6
luwigie
Member
 
Registered: Aug 2004
Location: Michigan, USA
Distribution: Fedora Core 2
Posts: 42

Original Poster
Rep: Reputation: 15
A couple of questions:

So the user that it runs as is root?

Where does the output go? No where?

Do I just put in the commands on a line the same way I would at a command line, or do I have to seperate the commands more than just putting them on a seperate line?

For instance would:
vnstat -u -i eth0
ntop

be sufficient to run two commands?
 
Old 08-26-2004, 06:11 PM   #7
luwigie
Member
 
Registered: Aug 2004
Location: Michigan, USA
Distribution: Fedora Core 2
Posts: 42

Original Poster
Rep: Reputation: 15
Or would I have to put someting in between the programs?

Also, can I just do "ntop" for example rather than ./usr/bin/ntop?
 
Old 08-26-2004, 06:26 PM   #8
Sinope
Member
 
Registered: Aug 2004
Location: Chicago
Distribution: Debian testing/unstable
Posts: 82

Rep: Reputation: 15
A newline is sufficient between the commands. Even a semicolon is enough, I think.

You may as well put /usr/bin/whatever rather than just whatever. I'm fairly certain $PATH is set before this point but it certainly cant hurt to give the full path.

--S
 
Old 08-26-2004, 10:05 PM   #9
rob.rice
Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 795

Rep: Reputation: 114Reputation: 114
Quote:
Originally posted by luwigie
A couple of questions:

So the user that it runs as is root?

Where does the output go? No where?

Do I just put in the commands on a line the same way I would at a command line, or do I have to seperate the commands more than just putting them on a seperate line?

For instance would:
vnstat -u -i eth0
ntop

be sufficient to run two commands?
yes it runs as root and you will have to be root to kill it

the out put gose where you tell it to go or there may be a default log file it would be best if you were to read the man pages for the commands you want to log there may also be other settings for a command to run noninteractively or you may want to run them as an at job
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can a command/program be run automatically on boot? chuanweizuo Linux - Hardware 1 11-28-2005 11:36 AM
How to run a command automatically on start up TKD Suse/Novell 6 11-03-2005 05:41 AM
Automatically run scripts on startup? Phaethar Fedora 10 09-24-2004 03:35 AM
How do I get Fedora to automatically run a command during startup? jlsain Linux - Software 2 03-23-2004 05:03 AM
How can the linux OS run script automatically at startup? tommylkc Linux - Newbie 1 06-26-2002 04:09 AM


All times are GMT -5. The time now is 03:52 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration