LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-02-2005, 02:23 PM   #1
mayank_a
LQ Newbie
 
Registered: Oct 2005
Location: India
Distribution: RedHat 7.3, Fedora 4
Posts: 19

Rep: Reputation: 0
How to register our own custom services to be initiated at known init level??


I need to create a system service whenever system starts it start by itself, without the need of anyone logging in.
Default initlevel is 5.
How to do it?? how to bring in perview of ntsysv menu??

Regards
Mayank
 
Old 10-02-2005, 02:59 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
init scripts change a lot between different distro, so it depends on which one you are running, but there's certainly no concept of registering at all. what you'd do is firstly create your own init scrip tin /etc/rc.d/init.d (paths vary slightly of course..) which will respond to stop, start, restart args as normal ones do. that should be all you need ot have it listed in ntsysv or such like. normally you can just copy a simple script that already exists in there.
 
Old 10-02-2005, 08:21 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 683Reputation: 683Reputation: 683Reputation: 683Reputation: 683Reputation: 683
If you look in the /etc/init.d directory, there will probably be a README file. There may also be a file named "skeleton". Take a look at those. There may also be some man-pages you can read through.

You may have the "chkconfig" program on your system. It can be used to install a service and determine the runlevels. This program examines and modifies a header in the program to determine which runlevels the program should run as.

For example, on my laptop, here is part of the beginning of /etc/init.d/pcmcia:
Code:
#! /bin/bash
# Copyright (c) 1996-2004 SuSE Linux AG, Germany.  All rights reserved.
#
# Author: Hubert Mantel <mantel@suse.de>, 1996
#         Christian Zoz <zoz@suse.de>, 2000
#         Joachim Gleissner <jg@suse.de>, 2004
#
# /etc/init.d/pcmcia
#
### BEGIN INIT INFO
# Provides:       pcmcia
# Required-Start: $local_fs
# X-UnitedLinux-Should-Start: coldplug
# Required-Stop:
# X-UnitedLinux-Should-Stop:
# Default-Start:  2 3 5
# Default-Stop:
# Description:    Loads pcmcia base modules and starts cardmgr
### END INIT INFO
Not all systems use this style of starting services. Even if your distro does, you will want to read the documentation that comes with your system.

For example, there may be man-pages for "init", "chkconfig", and even for items such as "inittab" and "init.d". Consider printing out the man-pages.
I use the command "man -t <topic> | kghostview -" to read manpages. This produces a postscript version (much better looking). You could print it out the man-page from the ghostscript viewer program, or by issuing the command,
"man -t <topic> | lpr" which pipes the output to the printer.

Good Luck.

Last edited by jschiwal; 10-02-2005 at 08:22 PM.
 
  


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
changing init level h3htimo Linux - Newbie 5 10-24-2005 11:05 PM
Different Resolution init level 3 ? utw-mephisto Red Hat 4 06-19-2005 06:38 AM
rpc services current patch level amrogers3 Linux - Security 0 03-03-2005 09:53 AM
Register a custom protocol Bjorne Linux - Software 1 11-13-2004 08:25 AM
init level settings rufius Linux - General 1 04-29-2003 06:57 PM

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

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

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