LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 01-14-2002, 02:44 PM   #1
Road
Member
 
Registered: Jan 2002
Distribution: Debian Based only but have tried most others.
Posts: 82

Rep: Reputation: 15
Question Startup services


The distro I am using has an Xinetd and a bunch of rc.d files. I am trying to get a program to run at startup but I am not sure how to start. Could some one point me in a good direction so I can figure out how to make programs run on startup?

Thanks

:smash:

Had to use the gif!
 
Old 01-14-2002, 02:52 PM   #2
bluecadet
Member
 
Registered: Oct 2001
Distribution: MD81 RH71
Posts: 555

Rep: Reputation: 30
add whatever file you want to /etc/rc.local and it will load on startup. if you're talkign abuot services and similar, you want to enable them properly using sysvinit or somethign like that
 
Old 01-14-2002, 04:10 PM   #3
Road
Member
 
Registered: Jan 2002
Distribution: Debian Based only but have tried most others.
Posts: 82

Original Poster
Rep: Reputation: 15
I thought thats how you do with the old init.d file not the xinit.d. I do not have an rc.local but rather
rc0.d
rc1.d
rc2.d
rc3.d
rc4.d
rc5.d
rc6.d

I could be completely wrong but I thought with the intro of xinitd.d everything changed?

Either way thanks for replying
 
Old 01-14-2002, 09:06 PM   #4
Road
Member
 
Registered: Jan 2002
Distribution: Debian Based only but have tried most others.
Posts: 82

Original Poster
Rep: Reputation: 15
Ahh ok I have it all figured out.

Anybody who needs anytype of help on runlevels and how linux starts up programs on boot should read this, its great!

http://www.penguinmagazine.com/Magazine/This_Issue/0018

I have been searching all day and this was a gold mine!
 
Old 06-07-2002, 05:57 PM   #5
koningshoed
Member
 
Registered: May 2002
Location: South Africa
Distribution: Gentoo
Posts: 103

Rep: Reputation: 15
Quoted from the above mentioned article:

"Links beginning with a capital "S" are to be started, whenever the system is entering the given runlevel.

"Links beginning with a capital "K" are to be stopped whenever leaving that runlevel."

Now, the following is my /etc/init.d/rc file, script used to start/stop the services as needed:

********** START /etc/init.d/rc ************************
#! /bin/sh
#
# rc This file is responsible for starting/stopping
# services when the runlevel changes.
#
# Optimization feature:
# A startup script is _not_ run when the service was
# running in the previous runlevel and it wasn't stopped
# in the runlevel transition (most Debian services don't
# have K?? links in rc{1,2,3,4,5} )
#
# Author: Miquel van Smoorenburg <miquels@cistron.nl>
# Bruce Perens <Bruce@Pixar.com>
#
# Version: @(#)rc 2.78 07-Nov-1999 miquels@cistron.nl
#

# Un-comment the following for debugging.
# debug=echo

#
# Start script or program.
#
startup() {
case "$1" in
*.sh)
$debug sh "$@"
;;
*)
$debug "$@"
;;
esac
}

# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
trap ":" INT QUIT TSTP

# Set onlcr to avoid staircase effect.
stty onlcr 0>&1

# Now find out what the current and what the previous runlevel are.

runlevel=$RUNLEVEL
# Get first argument. Set new runlevel to this argument.
[ "$1" != "" ] && runlevel=$1
if [ "$runlevel" = "" ]
then
echo "Usage: $0 <runlevel>" >&2
exit 1
fi
previous=$PREVLEVEL
[ "$previous" = "" ] && previous=N

export runlevel previous

# Is there an rc directory for this new runlevel?
if [ -d /etc/rc$runlevel.d ]
then
# First, run the KILL scripts.
if [ $previous != N ]
then
for i in /etc/rc$runlevel.d/K[0-9][0-9]*
do
# Check if the script is there.
[ ! -f $i ] && continue

# Stop the service.
startup $i stop
done
fi
# Now run the START scripts for this runlevel.
for i in /etc/rc$runlevel.d/S*
do
[ ! -f $i ] && continue

if [ $previous != N ]
then
#
# Find start script in previous runlevel and
# stop script in this runlevel.
#
suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
#
# If there is a start script in the previous level
# and _no_ stop script in this level, we don't
# have to re-start the service.
#
[ -f $previous_start ] && [ ! -f $stop ] && continue
fi
case "$runlevel" in
0|6)
startup $i stop
;;
*)
startup $i start
;;
esac
done
fi
# eof /etc/init.d/rc
***********************end***********************

Now, I'm aware my scripting is far from the best but like I understand the script, it'll run the kill scripts in the *new* runlevel? This seems wrong for me, as I understood it like the article said, and then I tried it that way - and for the first time in dunno how long - my trusted debian linux crashed on me when switching levels.

Any/all help *very* welcome.
 
Old 06-07-2002, 06:34 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
PLEASE PLEASE PLEASE do NOT drag up long dead threads. thanks.
 
  


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 services kola Fedora 2 12-02-2004 06:47 PM
Disabling startup services Corallis Fedora 2 08-02-2004 12:51 PM
Startup Services Command loadedmind Debian 3 11-11-2003 04:32 PM
Services startup? mikedderuki Linux - Software 5 09-26-2003 05:44 PM
Startup Services Stephanie Linux - General 2 08-07-2001 10:37 AM


All times are GMT -5. The time now is 09:26 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration