Apache stopped working after executing the command "node server" - node.js

I use PuTTY to execute SSH commands. I entered this command node server and pressed enter. After that, access to cPanel and WHM have failed. All my sites are down now. Only Power Panel is working. Could you guys suggest what should be done?
Thanks!

Sorry to answer my own question, it is now resolved. I used SurfEasy VPN in order to access PuTTY via a proxy. I was able to send the command pkill node and my sites are now running again.

Related

Using Huey with Django: How to keep run_huey command running?

I'm using Django on Ubuntu 18.04.
I've got everything set up. And I type python manage.py run_huey in the server (through an SSH connection) to start huey, and it works.
However this is done through the command line through SSH and it will shut off when I close the SSH connection.
How do I keep run_huey running so that it will stay active at all times? Furthermore, after a system reboot, how do I get run_huey to automatically start?
You may explore supervisorctl utility for ubuntu, it keeps process running and can log into file and any other features. Google it.

Teamcity SSH Exec cannot execute command that I can if I login with Putty

I can execute "pm2 restart next" totally fine if I login myself to the server and do it, and I can do it from anywhere. But, if I try to do the same thing with a Team City build using SSH Exec, and also using the same user I normally login with, it fails. Any thoughts?
Had to run the command like this -> /home/ubuntu/.nvm/versions/node/v16.13.0/bin/pm2

I have hosted my Nodejs Application on Amazon AWS. Now it shows 502 bad gateway after some time

I started the server using Command prompt by the command "sudo node server.js"
Then I closed the command prompt.
Now after some time, the website automatically shows 502 bad gateway error.
I had also used the command "sudo node server.js &" but it still not works.
Can you help me find out what could be the possible problem.
Thanks in advance!
The problem is that you app is not running, here is why.
When start the application in the command line, the application is handled by that bash instance. When you close that instance, so does the application.
The solution to this is to use a package like pm2 which will make sure that your application is always running.

Connecting to Localhost on Mac from Another Mac: Websocket Issues?

I have a node.js web app running on http://localhost:3000/ on my iMac. I am able to log on to that web app from Chrome on my MacBook using the Wi-Fi IP address of my iMac (found in System Preferences->Network) and the port my web app is running on:
http://10.0.0.37:3000
When using this technique, is there any reason why a websocket would fail in calling a service on a distant server?
Thanks in advance to any thoughts!
It turns out nothing was wrong with websockets. The camera on my MacBook was deactivated for some reason, and that was causing errors from the service I was accessing. I was able to reactivate the camera using instructions from this page:
Quit all apps that you are trying to use with the Camera > Open
Terminal (find in /Applications/Utilities) > copy and paste the
following command then hit the Enter key > Type administrator password
hit Enter.
sudo killall VDCAssistant
if still at the terminal, issue the following command:
sudo killall AppleCameraAssistant

I can't keep my server running once I close terminal or my ssh session

I have never set up a server before but since Parse announced that they are closing down I thought I might give it a shot. I have followed along with this tutorial and have managed to migrate my Parse database across to digital ocean.
When I call npm run start everything works fine. I can query for data and create new objects all from my iOS app. But there is just one problem. How do I keep the server up and running even when terminal is not running from my Mac.
When I call npm run start this is what gets logged in terminal:
> parse-server-example#1.0.0 start /var/www/parse
> node index.js
[TypeError: Cannot read property 'Kerberos' of undefined]
DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.
I know that this is probably a noob question and yes my knowledge is quite limited, so if you could help me then that would be great!
Thanks for your time!
Okay so I have just found the answer after posting a question on the Digital Ocean question page, instead of running npm run start I should have been doing nohup npm start &
use screen to create a new session https://tournasdimitrios1.wordpress.com/2010/11/04/linux-the-screen-command-a-must-for-ssh/
start your server
detach session
return to running session when needed
+1 to Lev for his answer, I don't have enough reputation to upvote his answer.
Another option is tmux, like screen, you create a session then start your app and detach when done and your app will continue to run.
I see this document can help you. https://www.npmjs.com/package/forever. I tried in window. It is OK.
Those are my comment
*** Run background code with schedule
Linux: nohup file-nodejs.js &
Window:
Install forever: npm install forever -g
Start/Stop : forever start file-nodejs.js | forever stop file-nodejs.js (restartall | restart | stopall)
Reference : https://www.npmjs.com/package/forever

Resources