LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 03-06-2005, 11:50 PM   #1
casentm
LQ Newbie
 
Registered: Mar 2005
Location: Sacramento, CA
Distribution: Fedora
Posts: 1

Rep: Reputation: 0
init.d service start Question


Hello:

I am trying to setup a new service under Fedora. I have done the following so far:

Created a file in /etc/rc.d/init.d named "viper"

Performed the required chkconfig --add myservice to have a symbolic link created in the rc2.d directory that points to my file in init.d

I am running into issues when I try to start the service and I know it is because of my init.d file. At the top of the file I did put the required chkconfig entry (2345 90 10).

So here is the big question. I am not sure what to put in the start () command to get my service to actually start. I know how to start it via command line but when I put this command in the start() area, it bombs with the following error:

Starting viper: execvp: No such file or directory

I know it must be something dumb I am doing but in the start() routine, here is how I am trying to start it:


DAEMON=viper
prog=viper

start () {
echo -n $Starting $prog: "

# start daemon
daemon $DAEMON
if [ -f /usr/viper/bin/viper ]; then
/usr/viper/bin/viper
fi
[ $RETVAL = 0] && touch /var/lock/subsys/viper
touch /var/lock/subsys/viper
return $RETVAL

RETVAL=$?
echo

}


When I issue the command /usr/viper/bin/viper on any command line, my script will start but not with this.

Any and All Help MUCH APPRECIATED!

Mike
 
Old 03-07-2005, 12:26 AM   #2
zeropash
Member
 
Registered: Apr 2003
Location: Bangalore,India
Distribution: FC2, RHES, RH9, FC3, FC1, Slackware 3.0
Posts: 208

Rep: Reputation: 30
few problems I notice
1) the viper program is not in the standard path. So probably you should declare DAEMON=/usr/viper/bin/viper
2) if you are using daemon then you need not check the existance of the executable and run it manually.
3) you make use of RETVAL but never initialize it. the statement after daemon should be RETVAL=$?

probably this is what you want.

DAEMON=/usr/viper/bin/viper
prog=viper
...
start() {
echo -n $"Starting $prog: "
daemon $DAEMON
RETVAL=$?
echo
[ $RETVAL = 0] && touch /var/lock/subsys/viper
return $RETVAL
}

Last edited by zeropash; 03-07-2005 at 12:32 AM.
 
Old 03-20-2005, 08:23 PM   #3
LLS
Member
 
Registered: Sep 2003
Location: North America
Distribution: FC6 FC7 F8
Posts: 75

Rep: Reputation: 15
try putting it in "/etc/rc.d/rc.local", that is where the apache start script lives.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
when i try to start samba pdc's smb service nmbd failed to start . sandeepchau123 Linux - Newbie 2 10-20-2007 01:59 PM
service squid.init stop says [failed] Niceman2005 Linux - Software 2 11-16-2004 06:20 PM
Difference between init.d, xinetd and running service as a dameon jstephens84 Linux - Newbie 1 09-13-2004 06:19 PM
Service Shutdown and Init Setup g_goblin Solaris / OpenSolaris 1 10-29-2003 03:53 PM
Service start-up n.antonio Linux - Software 2 05-02-2003 09:57 PM


All times are GMT -5. The time now is 04:32 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