Results 1 to 10 of 10

Thread: Reboot in a post-script

  1. #1
    e11768 NNTP User

    Exclamation 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

  2. #2
    ab@novell.com NNTP User

    Default Re: Reboot in a post-script

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

  3. #3
    e11768 NNTP User

    Unhappy Re: Reboot in a post-script

    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

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,822

    Default Re: Reboot in a post-script

    Quote Originally Posted by e11768 View Post
    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
    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:
    Code:
    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):
    Code:
    echo "#!/bin/sh
    rm /etc/init.d/rc3.d/S99reboot
    reboot" >/etc/sbin/rc3.d/S99reboot
    (the differenece is in the last line).
    Henk van Velden

  5. #5
    ab@novell.com NNTP User

    Default Re: Reboot in a post-script

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

  6. #6
    e11768 NNTP User

    Default Re: Reboot in a post-script

    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

  7. #7
    e11768 NNTP User

    Default Re: Reboot in a post-script

    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.

  8. #8
    ab@novell.com NNTP User

    Default Re: Reboot in a post-script

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

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,822

    Default Re: Reboot in a post-script

    As S99reboot is removed and created every time it will not normaly have execute permission for anyone. A
    Code:
    chmod u+x S99reboot
    might remedy this.
    Henk van Velden

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,822

    Default Re: Reboot in a post-script

    And I am persistent in saying that though you have changed your
    Code:
    cat /etc/init.d/rc3.d/S99reboot << EOF
    in
    Code:
    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.
    Henk van Velden

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •