PDA

View Full Version : Reboot in post script



Neha1234
17-May-2012, 10:24
I am using SUSE 10 and I am trying to execute my script through post install script.
And my script contains code for reboot.

My post install script looks like:
pushd ###
sh sample.sh
popd

and I created link as follows:
ln -sf <path to post install script> /etc/rc.d/rc3.d/S99reboot

sample.sh contains code for reboot.
It reboots However, it keeps rebooting over and over. It seems the code inside of S99reboot is never executed.

Any help will be appreciated.
Thanks

smflood
17-May-2012, 12:58
On 17/05/2012 10:34, Neha1234 wrote:

> I am using SUSE 10 and I am trying to execute my script through post
> install script.
> And my script contains code for reboot.
>
> My post install script looks like:
> pushd ###
> sh sample.sh
> popd
>
> and I created link as follows:
> ln -sf<path to post install script> /etc/rc.d/rc3.d/S99reboot
>
> sample.sh contains code for reboot.
> IT REBOOTS HOWEVER, IT KEEPS REBOOTING OVER AND OVER. IT SEEMS THE
> CODE INSIDE OF S99REBOOT IS NEVER EXECUTED.
>
> Any help will be appreciated.
> Thanks

Duplicate of
http://forums.suse.com/showthread.php?1074-Reboot-in-post-script
--
Simon
Novell/SUSE/NetIQ Knowledge Partner

------------------------------------------------------------------------
Do you work with Novell technologies at a university, college or school?
If so, your campus could benefit from joining the Novell Technology
Transfer Partner (TTP) program. See novell.com/ttp for more details.
------------------------------------------------------------------------

Magic31
17-May-2012, 14:56
I am using SUSE 10 and I am trying to execute my script through post install script.
And my script contains code for reboot.

My post install script looks like:
pushd ###
sh sample.sh
popd

and I created link as follows:
ln -sf <path to post install script> /etc/rc.d/rc3.d/S99reboot

sample.sh contains code for reboot.
It reboots However, it keeps rebooting over and over. It seems the code inside of S99reboot is never executed.

Any help will be appreciated.
Thanks

Hi,

Don't get why you are trying to do it like this... So I'm curious, why don't you simply call a reboot or shutdown command in your script?

Cheers,
Willem

Neha1234
18-May-2012, 04:28
Hi,

Don't get why you are trying to do it like this... So I'm curious, why don't you simply call a reboot or shutdown command in your script?

Cheers,
Willem
Actually the code of reboot is in my sample.sh script only. But I want after every reboot my script gets executed and reboot occurs . But reboot is ocuuriong over and over and my script is never executed.
If I create empty and linked it with S99reboot in use level 3 the same problem persist.

Magic31
18-May-2012, 06:37
But I want after every reboot my script gets executed and reboot occurs . But reboot is ocuuriong over and over and my script is never executed.

Ok... so if I understand correctly the server is still in a reboot loop? And you need to fix this first?

You should be able to boot into single user mode (enter "init 1" as boot option at the grub boot screen) and remove customizations made that are causing the loop (which is not clear to me as I don't see that symbolic link you mention being the cause of that?).

In any case, I usually place a after.local script file in /etc/init.d (and chmod +x it) to let extra "stuff" get done after the server has booted. Might be that is what you are after? (as I don't understand what you are trying to do with you script)

Cheers,
Willem

Neha1234
18-May-2012, 06:55
Yes I have done the same and server has came out of reboot loop.
And I also tried the same created file in /etc/init.d folder and chmod +x created link in user level 3 in /etc/rc.d/rc3.d/S99reboot but again the server is going in reboot loop.

Magic31
18-May-2012, 09:29
And I also tried the same created file in /etc/init.d folder and chmod +x created link in user level 3 in /etc/rc.d/rc3.d/S99reboot but again the server is going in reboot loop.

Once a script is placed in /etc/init.d and has the execute attribute set, you can use the insserv and chkconfig commands to control what happens during boot/change of runlevel. Doing this by hand is not something I'd recommend as the given tools also do the job at looking at placing the scripts in proper order etc.

Again, with what you are doing - and if I understand it correctly - it's logical that the server ends up in a reboot loop... as you are starting a script at boot telling the server to reboot. I don't see what you are trying to achieve...(??)

-Willem

Neha1234
18-May-2012, 09:51
Yes you are right but in my script I have passed COUNT variable for number of reboots.
Actually through my script I want system to reboot COUNT times.
Let say COUNT=10 than system should reboot 10 times only and then it should stop rebooting.
But in my case it is going in infinite loop.

Magic31
18-May-2012, 11:35
Yes you are right but in my script I have passed COUNT variable for number of reboots.
Actually through my script I want system to reboot COUNT times.
Let say COUNT=10 than system should reboot 10 times only and then it should stop rebooting.
But in my case it is going in infinite loop.

Seems like something in the script ain't workin' :)

How are you writing the count values (where to) and how is it getting compared when the system boots again?

Not sure why you would need this.... this is not Windows we are talking about :P Why so many reboots?

Cheers,
Willem

Neha1234
18-May-2012, 12:20
I am redirecting value of COUNT in file and when rebooting the system Count value is compared to COUNT_MAX i.e.10 which is also written in file.
But main cause is my script is never gets executed after 1st reboot because value of COUNT never goes beyond 1.

Magic31
18-May-2012, 13:13
I am redirecting value of COUNT in file and when rebooting the system Count value is compared to COUNT_MAX i.e.10 which is also written in file.
But main cause is my script is never gets executed after 1st reboot because value of COUNT never goes beyond 1.

Maybe the script is been getting called to soon? (to soon as in the mount path not being available yet).... looking at the boot.msg might give some more clues.