LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 02-17-2003, 01:51 AM   #1
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Rep: Reputation: 15
Running a service at startup


I want a service to run at startup.

Since I'm new in Linux, please give me detailed instructions.

Thanks!
 
Old 02-17-2003, 02:01 AM   #2
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Wow, it really doesn't get more vague than that A generalized answer would be to suggest putting it into your rc.local file, usually in /etc

However, if you give us some details we might be able to help a bit more. What distro? What service?

Cool
 
Old 02-17-2003, 02:10 AM   #3
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
lets say, i installed alpha in /usr/local, and the command script is /usr/local/alpha/bin/alpha.sh

what i do now is run alpha.sh start manually every time i reboot the machine.

so what should i do about it, masterc?

Thanks for your help!
/usr/local
 
Old 02-17-2003, 02:16 AM   #4
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Place /usr/loca/alpha/bin/alpha.sh in your /etc/rc.local file (again, this depends on your distro, but for the most part your distro should have this file).

So using your favorite text editor open up your rc.local file, and place this line in there:
/usr/loca/alpha/bin/alpha.sh

Then save and exit, and you are done.

Cool
 
Old 02-17-2003, 02:31 AM   #5
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
I tried appending /usr/local/alpha/bin/alpha.sh to [B]/etc/rc.d/rc.local[B], but it does not seem to be working.

How do I check if something is running or not?

My system is Red Hat 7.1, incidentally.

What should I do next?
 
Old 02-17-2003, 02:34 AM   #6
keevitaja
Member
 
Registered: Aug 2002
Location: Estonia
Distribution: XP PRO
Posts: 119

Rep: Reputation: 15
do
ps -axu | grep alpha.sh

if it is not there then try

/sbin/chkconfig /usr/local/alpha/bin/alpha.sh --level 345 on

but i am not sure, if this command works with user defined services. and you must reboot.

Last edited by keevitaja; 02-17-2003 at 02:36 AM.
 
Old 02-17-2003, 02:40 AM   #7
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
how do i use chkconfig to add it to startup?

i know the syntax is
chkconfig --add <name>

but i guess i should do something before running
chkconfig --add alhpa

is that correct?
 
Old 02-17-2003, 02:49 AM   #8
keevitaja
Member
 
Registered: Aug 2002
Location: Estonia
Distribution: XP PRO
Posts: 119

Rep: Reputation: 15
i think the questin is how will chkconfig know where is that alpha you are trying to run... never used it like that. only services which are located in /etc/init.d
 
Old 02-17-2003, 02:51 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,376

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
chkconfig can only be used with proper daemon control services, not general applications. if running "/usr/local/alpha/bin/alpha.sh" works on a command line then it MUST work running it in rc.local, just remember to add a & to the end to make sure it forks.
 
Old 02-17-2003, 03:09 AM   #10
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
this looks very strange to me.

alpha is started when system initiates, i can locate it in processes, but it is not working properly.

actually, "alpha" is a web server. i added
/usr/local/alpha/bin/alpha.sh start &
to /etc/rc.d/rc.local, rebooted the machine, but alpha is not serving as it is expected to. i ran ps -axu, and found it among the process

what do you guys think is the issue?

newbie correro
 
Old 02-17-2003, 03:00 PM   #11
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Maybe who it is run as?
 
Old 02-17-2003, 07:01 PM   #12
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
what does that mean, masterc?
do i need to specify who runs it? if so, how?
 
Old 02-17-2003, 07:04 PM   #13
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
When you run ps -aux who does it say the process is running as? When you run the process by hand after the install (assuming it's not in rc.local) what user do you run it as?

Cool
 
Old 02-17-2003, 07:21 PM   #14
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
if "ps -aux | grep alpha" does not return a line about alpha, does it mean alpha is not started at all?
that is the case now, though i have added "/usr/local/alpha/bin/alpha.sh start &" to /etc/rc.d/rc.local
what do you think i should do?
 
Old 02-18-2003, 07:00 PM   #15
menhilmor
LQ Newbie
 
Registered: Jul 2002
Distribution: Slackware 8.1
Posts: 16

Rep: Reputation: 0
.

I would start alpha like normal from a command line, see if I can find what it looks like using ps, and then try to find that same info using ps after I try rebooting with alpha.sh in rc.local. That's the vague answer to a vague alpha.sh.

I would wonder why rc.local isn't kicking stuff off the way it should. Maybe you could try putting other scripts in there to see if alpha.sh has problems or if rc.local has problems? Maybe just an echo "HI I'M IN RC.LOCAL" for you to watch for during boot?

I'm new to Linux too, this is just stuff I would look for.
 
  


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
Startup Programs as a Service? keithieopia Linux - Newbie 4 02-26-2005 09:44 PM
Network service startup imurch01 Linux - Networking 6 01-16-2005 10:37 PM
startup the service automatically ashley75 Linux - General 4 09-24-2003 02:14 AM
how to interrupt service at startup mehlkelm Linux - General 9 05-03-2003 10:35 AM
Stopping a startup service MrJoshua Linux - General 1 05-15-2002 02:03 PM


All times are GMT -5. The time now is 07:16 AM.

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