LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 03-20-2003, 08:26 PM   #1
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Rep: Reputation: 15
Question Creating init scrips in Linux


I've been wanting to know how to make an initialization script for when I boot-up linux. Just like the scripts that are executed for each run level. If anyone knows how to make these or has a resource to point me to PLEASE reply!!

OS: SuSE 8.0

thanks
marshall
 
Old 03-20-2003, 08:42 PM   #2
Texicle
Member
 
Registered: Oct 2002
Location: Northern Ontario, Canada
Distribution: Slackware 10.0
Posts: 789

Rep: Reputation: 30
Are you wanting to create your own or modify existing ones?
 
Old 03-20-2003, 08:44 PM   #3
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Texicle
Are you wanting to create your own or modify existing ones?
Create my own and modify existing. I'd like to know about both.
 
Old 03-20-2003, 09:02 PM   #4
Texicle
Member
 
Registered: Oct 2002
Location: Northern Ontario, Canada
Distribution: Slackware 10.0
Posts: 789

Rep: Reputation: 30
To learn about them, I'd go through all my rc.* files in /etc/rc.d directory as well as anything in lilo or grub files. For instance, /etc/rc.d/rc.local will have a bunch of entries for other files to run at boot time like rc.M or rc.modules or rc.serial, etc. If you then go through them all with a text editor you should be able to see how they're structured as well as their syntax. You will be able to modify existing ones, and will be able to compare your newly created scripts to those that already exist.

If I'm wrong, someone will surely correct me or at the very least add to the list of rc.* files that you can peruse. Hope this helps.
 
Old 03-20-2003, 09:07 PM   #5
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Original Poster
Rep: Reputation: 15
I don't see any rc.local.
 
Old 03-20-2003, 10:24 PM   #6
Texicle
Member
 
Registered: Oct 2002
Location: Northern Ontario, Canada
Distribution: Slackware 10.0
Posts: 789

Rep: Reputation: 30
SuSE my have different files. Hopefully someone with SuSE will know. I think this will work though once you find out the correct file name.
 
Old 03-20-2003, 10:27 PM   #7
aherm
Member
 
Registered: Jan 2003
Location: upNorth
Distribution: openSuSE/uBuntu
Posts: 410

Rep: Reputation: 30
It is in here:

/etc/init.d/boot.local

for you to create one.


#
# Start user defined bootup script.
#
if test -f /etc/init.d/boot.local ; then
echo "Running /etc/init.d/boot.local"
/bin/sh /etc/init.d/boot.local
rc_status -v1 -r
fi


Have a lot of fun :-)
 
Old 03-21-2003, 05:38 PM   #8
Road
Member
 
Registered: Jan 2002
Distribution: Debian Based only but have tried most others.
Posts: 82

Rep: Reputation: 15
On a RH system there is instructions on how to do it here:

/usr/share/doc/initscripts-6.95

You will also find a bunch of other instrucions more detailed than the man pages for most of the applications you install.

Road
 
Old 03-21-2003, 08:15 PM   #9
rmartine
Member
 
Registered: Dec 2002
Location: San Luis Obispo, CA
Distribution: Fedora Core 3
Posts: 618

Rep: Reputation: 30
Hey on the beyond LFS website they have a great tutorial on multiple ways of setting up boot scripts. They explain what they're for and why each line is there. They're very simple and easy to follow. Check this link out.

http://hints.linuxfromscratch.org/hints.shtml
 
Old 03-22-2003, 01:54 AM   #10
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Re: Creating init scrips in Linux

Quote:
Originally posted by rootking
I've been wanting to know how to make an initialization script for when I boot-up linux. Just like the scripts that are executed for each run level.
In general, one of these scripts will look something like:
Code:
#!/bin/sh

start() {
  echo "Starting NiftyApp (tm)..."
  [ do app startup stuff ]
}

stop() {
  echo "Stopping NiftyApp (tm)..."
  [ do app shutdown ]
}

case "$1" in
start) start ;;
stop) stop ;;
restart) stop ; start ;;
*) echo "Dunno how to $1"
esac
Look in your SYSV init script subdirectory (/etc/rc.d/init.d in RH; same for Suse?) for some examples. You can test it without having to boot and when it's working correctly create the appropriate symbolic links in the rc0.d/rc3.d/rc5.d subdirectories.

Hope this helps a bit...

Rick
 
  


Reply



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
make install-init creating wrong symbolic link ServerStorm Linux - Software 1 01-18-2005 02:32 PM
SMB mounting scrips hangs phatboyz Linux - Networking 2 06-23-2004 10:06 PM
Is it possible to run VB scrips in Linux? to_veera Linux - Software 2 06-07-2004 06:44 AM
EXIM - sending spam from PHP scrips GRisha Linux - Software 0 06-05-2004 11:07 AM
Two simple questions...shell scrips and icons vdogvictor Linux - General 4 04-12-2004 05:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:51 PM.

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