How to programmatically restart a node application?

Avatar
  • updated
  • Answered

I have a shared instance with a node application (I've seen another post where they tell someone that node can't be used in shared instances, so don't try to remove my node privileges) that it's prone to fatal errors, thus bringing down the application.

I tried using PM2 for 24/7 availability of my app but it seems that inmotion just doesn't allow this with my app, which isn't fine but I get it, however, I'm unable to find documentation for the cPanel API (if any) in order to create my own script to programmatically check the status of my app and issue a restart.

So, to summarize, how can I access cPanel node application status and if there's any way to restart a node app directly from the console?

Thanks.

Pinned replies
Avatar
Josh Green
  • Answer
  • Answered

This week, we have identified and corrected this issue on servers throwing errors. Please try again and let us know if it is working correctly now.

Avatar
Josh Green
  • Answer
  • Answered

This week, we have identified and corrected this issue on servers throwing errors. Please try again and let us know if it is working correctly now.

Avatar
marco cordero

OP Here
Customer support is hesitant to tell you that you can use
cloudlinux-selector start--json --interpreter nodejs --user [USER] --app-root [APP_NAME]

(APP_NAME might be structured like a directory path)


And remember, don't let them tell you that shared instances can't run node applications, they'd be lying, although you can't use a self-hosted mongoDB instance...