Results 1 to 5 of 5

Thread: How to make application auto-run again after power failure?

  1. #1

    Default How to make application auto-run again after power failure?

    Hello,

    I have a OpenSUSE 15.0 server which running nginx with multiple IPs. I met two times power failure in this month because of data center 's power supply fire. When the power came back, I found the server auto reboot-itself but without nginx running.

    systemctl enable nginx

    doesn't work. I don't know why. I have to login to this server and manually start nginx and other app.

    Can someone tell me a good way to make the nginx auto run again after power failure? Thank you.


  2. #2
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,841
    Blog Entries
    14

    Default Re: How to make application auto-run again after power failure?

    Immediately after a reboot, show
    Code:
    systemctl status nginx
    FWIW, enabling a service is not enough, it needs to be started, too:
    Code:
    systemctl start nginx.service
    Last edited by Fraser_Bell; 30-Sep-2018 at 13:14. Reason: Fix typo
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,254
    Blog Entries
    2

    Default Re: How to make application auto-run again after power failure?

    Typically the UPS software you should have installed should support executing special commands including starting services.

    But,
    There may be a specific problem that is preventing your nginx from starting...
    Perhaps look at your bootlog for the specific session that suffered the power failure as well as the bootlog for the service start failirue

    For the following command, you can specify any previous bootlog by changing the n which a number
    Code:
    journalctl -b -n
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  4. #4

    Default Re: How to make application auto-run again after power failure?

    Thank you guys.

    1. UPS is supplied by data center. I think it is only for the whole rack, not for my dedicated server.

    2.
    I have checked reboot log, maybe I don't understand all of it. It looks no special, just normal starting the server.
    And the nginx configurations have no conflict.

    I can manually "systemctl start nginx"

    It looks so strange.



    So, is there a way to monitor nginx, when it is not running, the system will start it? Thank you

  5. #5
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,254
    Blog Entries
    2

    Default Re: How to make application auto-run again after power failure?

    Quote Originally Posted by peng_u View Post
    Thank you guys.

    1. UPS is supplied by data center. I think it is only for the whole rack, not for my dedicated server.

    2.
    I have checked reboot log, maybe I don't understand all of it. It looks no special, just normal starting the server.
    And the nginx configurations have no conflict.

    I can manually "systemctl start nginx"

    It looks so strange.



    So, is there a way to monitor nginx, when it is not running, the system will start it? Thank you
    Post the following for your machine so we can verify your configuration
    Code:
    systemctl status nginx
    The following should display all system log entries for your nginx service for a specified bootlog (you'll have to know how many times your system might have rebooted since the power failure). The following assumes that the current session is the second time you've rebooted your machine since your power failure
    Code:
    journalctl -b -2 -u nginx.service
    Post your results of the above if you need help interpreting the entries.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

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