-3

Server Type - VPS

OS - Centos

Panel - cpanel

Root access - Yes i have.

Sometime due to load or some other issues my vps goes down. Then i always need to perform a restart by login at my host's server control panel.

When i click on restart tab after few minutes my server come back online.

But i want to do that pragmatically or with some kind of script.

I can detect when my server gets down. I have my own server monitoring system but its not possible for me to be available online every time when my server goes down. So i bear loss at that time.

That is why i am looking for making a script by which i can remotely send a reboot/restart request automatically to my down VPS. Same way like my host's server control panel does.

But i am not getting any clue about how to do that?

Is there any hidden kind of access that you perform to reboot/restart to the server?

May i know if is there any kind of API to do so?

Any technical advice will be an advantage for me.

Thank you,

4
  • 1
    Who’s the VPS with? Some VPS providers provide an API that allows you to perform actions such as poweroff/on
    – CrispyDuck
    Commented Mar 11, 2018 at 14:22
  • Its contabo. I dont think they provide. @CrispyDuck Commented Mar 11, 2018 at 14:38
  • Where do you propose to run this script? Commented Mar 11, 2018 at 16:01
  • from the another server. I have six different servers @MichaelHampton Commented Mar 11, 2018 at 17:37

1 Answer 1

1

Your system doesn't go down "due to load or some other issues". It goes down because you've misconfigured it. For example if the main application takes up all CPUs, it's your job to prepare the system to survive that. If I were you, I'd get to work on finding a root cause.

That being said the most common solution on centos 7 for the use-case you presented is pacemaker with multitude of various fence agents. The fence agents are responsible for telling various VPSs' APIs to cold-boot the unresponsive system.

Again, it's much more beneficial to find a root cause than to spend time on learning pacemaker.

1
  • actually i am running youtube-dl / ffmpeg command line programs on my vps. These things produce high load. So sometime when load goes out of control. Server goes down. I am not able to reduce the load which is occurred by both of these applications. Commented Mar 12, 2018 at 3:50

Not the answer you're looking for? Browse other questions tagged .