LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2006, 10:42 PM   #1
karpa
LQ Newbie
 
Registered: Feb 2006
Posts: 21

Rep: Reputation: 15
script file


Hi i am very new to linux, (i have ubantu) and would like to start a program when the pc boots.
What i found out so far is to put a command in /etc/rcS.d Am i right? if so, how shall i write the command?
 
Old 02-16-2006, 11:45 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Read the man pages on inittab.
from inittab, you eventually get to the links in the various rc files. prefix "K" means kill when entering this runlevel, and "S" means start. The files link to scripts in /etc/init.d, but they can also be just links to basic commands.

Various books have a complete narrative on the whole init process. There is probably also an online tutorial.
 
Old 02-16-2006, 11:45 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
dup post--sorry
 
Old 02-17-2006, 04:34 AM   #4
karpa
LQ Newbie
 
Registered: Feb 2006
Posts: 21

Original Poster
Rep: Reputation: 15
Sorry but can you explain in detail, as I only had linux for 3 days, and only know a little.
 
Old 02-17-2006, 05:59 AM   #5
saman007uk
Member
 
Registered: Dec 2003
Location: ~root
Distribution: Debian
Posts: 363

Rep: Reputation: 33
If you are not root, run:
Code:
sudo bash
This will ask you for your password. Then run:

Code:
cp script /etc/init.d/script
updare-rc.d script defaults
Here, script is the name of the script.

Last edited by saman007uk; 02-17-2006 at 06:02 AM.
 
Old 02-17-2006, 11:18 AM   #6
karpa
LQ Newbie
 
Registered: Feb 2006
Posts: 21

Original Poster
Rep: Reputation: 15
ok, i understood that but what shall i write in the script.
 
Old 02-17-2006, 12:48 PM   #7
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,397
Blog Entries: 1

Rep: Reputation: 64
For general purpose tasks, there is /etc/rc.local or as in SuSE, /etc/rc.d/boot.local.

This file is executed at the boot time, just before the system becomes ready to use. All resources are ready at time this file is executed. You can call any scripts you want here.

The scripts at /etc/init.d/rc<n>.d/ are symbolic links to files on /etc/init.d/ and they follow a strict convention about syntax, dependencies about another services, special comments in the header of file used by programs like chkconfig. They are used to start/stop daemons for several services.

My advice is to put any local stuff to rc.local or whatever it is the name in your system.


I hope this can help,
 
  


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
How to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 12:00 PM
Help with script file hilljack13 Linux - Newbie 3 05-13-2003 08:33 PM
help me with this script file alaios Linux - General 11 05-03-2003 03:29 AM
Script that appends a file to start of other file amp2000 Programming 8 06-30-2002 10:56 AM
Script, Reading a file, When end of file? elibm Programming 2 07-16-2001 12:01 PM


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