LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-23-2010, 04:11 AM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,357

Rep: Reputation: 212Reputation: 212Reputation: 212
Any idea how to start a script only at boot ?


I have found on the net the solution (debian testing)

to add this /etc/init.d/myscript
Code:
### BEGIN INIT INFO
# Provides:          myscript
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start script at boot time and stop at shut down
# Description:       Enable service provided by daemon.
### END INIT INFO


######update-rc.d myscript defaults
# enter code below
and then it makes it as rc2.d but however it starts it when I turn off the pc too
 
Old 10-23-2010, 04:29 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Did you run
Quote:
update-rc.d
Take a look at
http://embraceubuntu.com/2005/09/07/...run-at-bootup/

Kind regards

Last edited by repo; 10-23-2010 at 04:31 AM.
 
Old 10-23-2010, 07:04 AM   #3
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,357

Original Poster
Rep: Reputation: 212Reputation: 212Reputation: 212
Quote:
Originally Posted by repo View Post
Did you run

Take a look at
http://embraceubuntu.com/2005/09/07/...run-at-bootup/

Kind regards
surely ... i ran update.rc

but this method rc2.d results in running the script too at boot + at shutdown of the machine (so both )
Only boot would be so gorgeous though

Quote:
So you have a script of your own that you want to run at bootup, each time you boot up. This will tell you how to do that.

Write a script. put it in the /etc/init.d/ directory.
Lets say you called it FOO. You then run

% update-rc.d FOO defaults

You also have to make the file you created, FOO, executable, using
$chmod +x FOO

You can check out
% man update-rc.d for more information. It is a Debian utility to install scripts. The option “defaults” puts a link to start FOO in run levels 2, 3, 4 and 5. (and puts a link to stop FOO into 0, 1 and 6.)

Also, to know which runlevel you are in, use the runlevel command.
 
  


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
to 'start only' a shell script on boot up aj_1988 Linux - Newbie 2 01-12-2009 09:19 PM
Howto start script at boot ? hendrixx Programming 3 11-15-2005 01:42 PM
getting script to start at boot short101 Debian 2 01-24-2005 06:32 AM
Script to start NoIP at boot downinthemine Linux - Software 3 04-20-2004 10:38 AM
Help with Howto start a shell script at boot draven Linux - Newbie 7 03-03-2004 11:20 PM

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

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