Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Servers & Networking
FedoraForum Search

Forgot Password? Join Us!

Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc.

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10th December 2007, 12:45 AM
gkk's Avatar
gkk Offline
Registered User
 
Join Date: Apr 2007
Posts: 24
Thumbs up chkconfig wokrs but service start says unknow service

I build a program that runs as a daemon, it works if I start it from command line.

But I want it to be running as a aservice.

I put binnarys in /usr/sbin

and a srcript to start it in /etc/init.d

chkconfig works, I can see my daemon in the list of services

but when I try service myservice start it says

service unknown


****************
I add this line here: the problem was that the script was not an excecutable scripts.
****************

here is the script

#!/bin/sh
#
### BEGIN INIT INFO
# Provides: serviciogk
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Short-Description: nothing
# Description: some_daemon is nothing.
# Really, nothing.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

DAEMON_NAME=serviciogk
DAEMON_PROCESS=serviciogk
DAEMON_BINARY=/usr/sbin/serviciogk
LOCK_FILE=/var/lock/subsys/$DAEMON_NAME
RETVAL=0

# default option, they can be overriden in /etc/sysconfig/$DAEMON_NAME
# of course, you can place what you want.
#OPTIONS=
#PORT=2000
# this file should be commented, with proper pointer to the doc, and you should use
# more than one line of option, if possible.
#[ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME

# here, you can do what you want with the option
start() {
# place the test here
# if [ -z "$SOME_VAR" ]; then
# echo "You need to set $SOME_VAR in /etc/sysconfig/$DAEMON_NAME"
# RETVAL=1
# return
# fi

if [ ! -f $LOCK_FILE ]; then
echo "Starting $DAEMON_NAME"
# use --user to run the daemon under the specified uid
#daemon $DAEMON_BINARY $OPTIONS -p $PORT
daemon $DAEMON_BINARY $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
fi
}

stop() {
echo "Shutting down $DAEMON_NAME"
killproc $DAEMON_PROCESS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
}

reload() {
echo "Reloading $DAEMON_NAME configuration"
killproc $DAEMON_PROCESS SIGHUP
RETVAL=$?
echo
}

status() {
status $DAEMON_PROCESS
RETVAL=$?
}

case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
reload)
reload
;;
restart)
stop
start
;;
condrestart)
if [ -f $LOCK_FILE ]; then
stop
start
fi
;;
*)
echo "Usage: $0 {start|stop|restart|reload|condrestart|status}"
RETVAL=1
esac

exit $RETVAL

Last edited by gkk; 10th December 2007 at 01:15 AM.
Reply With Quote
 

Tags
chkconfig, service, start, unknow, wokrs

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A service not in chkconfig neogranas Servers & Networking 3 16th July 2009 10:31 PM
chkconfig and service bghayad Using Fedora 4 19th June 2009 02:26 AM
service X does not support chkconfig arnieAustin Servers & Networking 9 10th January 2009 08:32 PM
The difference between service start and chkconfig kurtshi Servers & Networking 6 6th April 2008 05:11 AM
chkconfig and service RustyJuggler Using Fedora 10 3rd January 2006 03:00 PM


Current GMT-time: 15:50 (Friday, 24-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat