Boot script

General support questions
Post Reply
zycus
Posts: 9
Joined: 2011/07/27 09:44:50
Location: london

Boot script

Post by zycus » 2011/07/27 09:58:36

I want to run script before login.
I stored my script file in /etc/rc3.d.
still its not work.
Whenever i reboot it just hang up at theme page and it does not allowd me to log in.
I am using centos 6.
My script is for just showing me ip address and option with dhcp setting.
It work fine without any error.
It work in centos 5.6.

neo67
Posts: 3
Joined: 2011/07/27 10:49:31
Contact:

Re: Boot script

Post by neo67 » 2011/07/27 11:35:16

Hi,

please put a [code]ls -l [sriptname][/code]

here and put the content of the script itself here.
THX

neo67

zycus
Posts: 9
Joined: 2011/07/27 09:44:50
Location: london

Re: Boot script

Post by zycus » 2011/07/27 12:08:08

[quote]

-rwxr-xr-x 1 root root 5060 Jul 28 01:40[/quote]

saleh
Posts: 97
Joined: 2011/02/18 18:35:11
Location: ~/egypt/alexandria
Contact:

Re: Boot script

Post by saleh » 2011/07/27 12:56:58

yeah dear it should works with CentOS 5.x because the boot process starts all processes in rcx.d
but it different with CentOS 6.x, because it doesn't use regular boot process, it uses something called Upstart
so it starts jobs which is specified in each run levels in /init.d/ directory.
for more information see this link
[url=http://upstart.ubuntu.com/]http://upstart.ubuntu.com/[/url]

ixeous
Posts: 113
Joined: 2005/07/07 13:01:59

Boot script

Post by ixeous » 2011/07/27 13:01:27

Simple Solution:

If the timing works, I would try calling the script from /etc/rc.local. It will execute after all other init scripts. I'm not sure if it is before you have the ability to login or not though. Add a line to the end of the file calling your script.

More Complicated Solution:

If you need to start it via run levels, I would suggest putting your script into /etc/rc.d/init.d. That is the location of other startup scripts. The rcX.d directories are symbolic links to the scripts in init.d. The links in rcX.d directories all start with S or K and have some number. The number indicates the order that the script will run in the startup/shutdown process. S is start and K is kill. If you look at the contents of the scripts in the init.d directory, you will see a section in the script such as

# Linux chkconfig stuff:
#
# chkconfig: 2345 25 10
# description: Startup/shutdown script for the Common UNIX \
# Printing System (CUPS).


It is part of the commented section, but that defines the S number and K number as well as the run levels that the service will start. This will allow you to add your script as part of the chkconfig command. That will create and manage the S or K links for you in each of the rcX.d directories with the appropriate startup/shutdown order. It will also make the script easier to port to other systems and manage on an ongoing basis.

ixeous
Posts: 113
Joined: 2005/07/07 13:01:59

Re: Boot script

Post by ixeous » 2011/07/27 15:22:44

My previous post does describe the "old" method, but Upstart is configured to run the sysv runlevel scripts. Converting the script to a pure Upstart script may be your best choice

skolnick
Posts: 209
Joined: 2007/11/24 16:05:26

Re: Boot script

Post by skolnick » 2011/07/29 03:14:14

Hi!

I have seen this problem sometimes when I forget to add the & at the end of the line, so the script is run but it never ends so the system gets stuck. Maybe that's what's happening here

Regards.

zycus
Posts: 9
Joined: 2011/07/27 09:44:50
Location: london

Re: Boot script

Post by zycus » 2011/07/29 06:05:51

Thanks for your help.
But where should i add '&'.
In my script or where i am calling the file.
I tried both but it skip the execution of my script file and directly goes to login page.
It is because of plymouth theme.
I am changing the default theme to my customize theme.
In my script i am using dialog box.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Boot script

Post by gerald_clark » 2011/07/29 13:32:53

Startup scripts don't do interactive I/O.
You would be better off outputting to a file.

Do not double or tripple post.
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=32464&forum=55
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=32461&forum=55

Post Reply