Reboot in a post-script

I am using autoyast w/ SuSE 10 and I am trying to reboot from a postinstall script.
I’m doing an online update in the post-script, and I would like to make sure that
the system comes up with the new kernel.

So, this is what I have in my postinstall script:
> >>> #!/bin/sh
> >>>
> >>> cat /etc/init.d/rc3.d/S99reboot << EOF
> >>>
> >>> #!/bin/sh
> >>> rm /etc/init.d/rc3.d/S99reboot
> >>> reboot
> >>>
> >>> EOF

This partially works, when Yast is completed, it reboots… However, it keeps rebooting over and over. It seems the code inside of S99reboot is never executed.

Any help will be appretiated.
Thanks

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Does the system boot to runlevel three? I guess if it didn’t you
probably wouldn’t see the reboots happen over and over (unless that is
an unrelated event that happens to take place now). Perhaps have the
output (STDERR/STDOUT) from your ‘rm’ command go to a file you can
review after one of the reboots in case there is an error in there to be
read.

Good luck.

e11768 wrote:
| I am using autoyast w/ SuSE 10 and I am trying to reboot from a
| postinstall script.
| I’m doing an online update in the post-script, and I would like to make
| sure that
| the system comes up with the new kernel.
|
| So, this is what I have in my postinstall script:
|>>>> #!/bin/sh
|>>>>
|>>>> cat /etc/init.d/rc3.d/S99reboot << EOF
|>>>>
|>>>> #!/bin/sh
|>>>> rm /etc/init.d/rc3.d/S99reboot
|>>>> reboot
|>>>>
|>>>> EOF
|
| This partially works, when Yast is completed, it reboots… However, it
| keeps rebooting over and over. It seems the code inside of S99reboot is
| never executed.
|
| Any help will be appretiated.
| Thanks
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIhLFG3s42bA80+9kRAhMMAJ9/1RQdUexYhbhm0kGQPkNuEo5cqACfTaIs
Y6vtl7TDRD3MPA8PRfpODAI=
=tG1L
-----END PGP SIGNATURE-----

Well, actually the problem is that the code inside the S99reboot script is not executed… I tested it putting an empty script S99reboot inside the rc3.d directory and I saw the same behavior, it keeps rebooting over and over… even with an empty script without any reboot command

I do not understand this script. The cat statement outputs the contents of /etc/init.d/rc3.d/S99reboot and there is a ‘here document’ as standard input to cat, which it does not read (so it goes into the dustbin).

I supose you either want to add something to S99reboot which goes like:

echo "#!/bin/sh
rm /etc/init.d/rc3.d/S99reboot
reboot" >>/etc/sbin/rc3.d/S99reboot

or you want to have it a new contents (creating it on the fly when it is not there):

echo "#!/bin/sh
rm /etc/init.d/rc3.d/S99reboot
reboot" >/etc/sbin/rc3.d/S99reboot

(the differenece is in the last line).

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Well that’s good to know… so where do you have your reboot command
running? I presume this did NOT happen before you added whatever
software you are working on. Probably not the simplest thing to do but
if you could get a diff of relevant files before/after the software you
could track down where the problem is happening. Try loading to
runlevel 2 explicitly to make sure it doesn’t reboot. Try runlevel 5
for fun as well. If you get reboots in those scenarios perhaps it’s
something earlier in the boot process but, if not, the next step is to
find a reboot in /etc/init.d/rc3.d. What do you see on your screen
before it goes back down?

Good luck.

e11768 wrote:
| Well, actually the problem is that the code inside the S99reboot script
| is not executed… I tested it putting an empty script S99reboot inside
| the rc3.d directory and I saw the same behavior, it keeps rebooting over
| and over… even with an empty script without any reboot command
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIhLh+3s42bA80+9kRAkdXAKCLV19AzG7WuybhwVXmPc5gf0e0wACbBuF7
21VVgVJGOV6T0+n0CYgsgbk=
=UV6N
-----END PGP SIGNATURE-----

I am creating the script on the file in the <post-script> section in the autoinstall.xml (autoyast script).

So, this code is embedded in tha autoinstall.xml
and will be executed at the end of the installation before initialization.

cat > /etc/init.d/rc3.d/S99reboot << EOF
#!/bin/sh
rm /etc/init.d/rc3.d/S99reboot
reboot
EOF

Basically what is enclosed between EOF label will be the content of the S99reboot script.
The idea is that when the initialization happens, the system will reboot to take into account the kernel patches that were installed.

The issue is that it reboots over and over. It seems that the content of S99reboot is not executed, it just reboots…

Thanks

Well, the last test I performed, I did not have any reboot command running, that is the issue. It is rebooting just by adding S99reboot (empty) in the /etc/init.d/rc3.d

If I remove S99reboot, it works fine.

As S99reboot is removed and created every time it will not normaly have execute permission for anyone. A

chmod u+x S99reboot

might remedy this.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Well that’s strange… tried something else like S99rebootForMyApp?

Good luck.

e11768 wrote:
| Well, the last test I performed, I did not have any reboot command
| running, that is the issue. It is rebooting just by adding S99reboot
| (empty) in the /etc/init.d/rc3.d
|
| If I remove S99reboot, it works fine.
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIhMWT3s42bA80+9kRAsQdAJoDxcUCHaLysAof2k3iJRUh9yyKgQCfW9rF
s0cwfQjCMH3dKoh4KcBNGZc=
=0yZ5
-----END PGP SIGNATURE-----

And I am persistent in saying that though you have changed your

cat /etc/init.d/rc3.d/S99reboot << EOF

in

cat > /etc/init.d/rc3.d/S99reboot << EOF

this is an unneeded complex construction. Using echo looks simpler to anybody who happens to read your script.