Reboot in post script

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 /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

On 17/05/2012 10:34, Neha1234 wrote:
[color=blue]

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 /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[/color]

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 TTP Organization | Micro Focus for more details.

[QUOTE=Neha1234;4680]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 /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[/QUOTE]

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

[QUOTE=Magic31;4688]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[/QUOTE]
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.

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

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.

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

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.

[QUOTE=Neha1234;4716]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.[/QUOTE]

Seems like something in the script ain’t workin’ :slight_smile:

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 :stuck_out_tongue: Why so many reboots?

Cheers,
Willem

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.

[QUOTE=Neha1234;4721]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.[/QUOTE]

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.