How can I stop the http server, downloaded using 'npm install http-server"? - http

How can I stop the http server, downloaded using 'npm install http-server" comand in terminal (console) and launched then?

Simply Ctrl+C, if you read the output after you launch it, you should see:
Starting up http-server, serving xxx
Available on:
http://<some ip>:<some port>
Hit CTRL-C to stop the server

Its built on node so Kill the node process for stopping it if it stuck. You can find all the node process ids and see what I'd your server have and kill that.

Related

Linux Apline: restart nginx

I have Alpine Linux, 3.15.0 version on the server.
The installed nginx version is 1.21.6. I have performed apk update
nginx -t command successfully responds with
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
When I type nginx -s reload server responds with
2023/02/03 10:58:00 [notice] 54#54: signal process started
but nothing actually happens. It's like the process started and that's all.
What am I missing?
According to Nginx documentation, command nginx -s reload actually sends signal to nginx master process and
once the master process receives the signal to reload configuration,
it checks the syntax validity of the new configuration file and tries
to apply the configuration provided in it. If this is a success, the
master process starts new worker processes and sends messages to old
worker processes, requesting them to shut down.
Thus, we can consider that nginx is restarted (If we disregard the fact that the master process itself continued to work).
At the same time, if you want to totally restart nginx, you can stop it with nginx -s quit command and then start again. Or that's much better use your system service manager. If I'm not mistaken, there is an open-rc in Alpine, thus command will be rc-service nginx restart.

Error: Port 5000 is not open, could not start functions emulator

✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/socialape-6b2f7/overview
Ayhan-MacBookPro:socialape-functions macbook$ firebase serve
=== Serving from '/Users/macbook/Desktop/socialape-functions'...
Error: Port 5000 is not open, could not start functions emulator.
Run lsof -t -i tcp:5000 | xargs kill from your Terminal.
A common cause for this error occurs when the Firebase emulator is not cleanly shut down (e.g., closing your IDE that's running the emulator in an embedded Terminal session) This will leave the process running in the background and occupies the emulator's default port.
To resolve the conflict, find the process ID running on the port (here 5000) from your Terminal command line and then kill it.
The above one-liner finds the process ID and pipes it directly to kill (h/t #manav).
For additional info, check out: Find (and kill) process locking port 3000 on Mac
The bug seems to be on not your end
It is caused by a bug in a dependency (node portfinder).
A quick fix to edit it might be to use the old version of node portfinder (v 1.0.21). Alternatively, you can do it by editing node_modules/firebase-tools/lib/emulator/controller.js and changing yield pf.getPortPromise({ port, stopPort: port }) to yield pf.getPortPromise({ port, stopPort: port + 1 }).
You can see the answer to your question completely here in this SO link.
If you are facing this issue in macOS Pro then this solution is for you.
In MacOS , Port 5000 may be claimed by a new "AirPlay Receiver".
This can be disabled in Settings -> Sharing:
I'm also adding the Screenshot of settings panel for disabling AirPlay Receiver.
Disabling the AirPlay Receiver (if you do not need it) frees up port 5000.

How can I connect remote Opencpu server installed in RHEL/centOS platform and use opencpu JS to get results from R?

I am trying to connect R from a browser using opencpu js. I cannot have opencpu in local mode and I need it to run in remote host so that my javascript based app server can be access by multiple users from where bunch of input data needs to be sent to openCPU server and R modules should work independently for each user.
I have a centOS6 instance where I have R installed properly.
I have managed to install openCPU as well using the rpm binary https://archive.opencpu.org/centos-6/.
The installation was successful but ended with:
sudo rpm -ivh opencpu-server-2.1.0-rpm0.x86_64.rpm
Preparing... ########################################### [100%]
1:opencpu-server ########################################### [100%]
/var/tmp/rpm-tmp.T2qZY9: line 13: systemctl: command not found
/var/tmp/rpm-tmp.T2qZY9: line 14: systemctl: command not found
/var/tmp/rpm-tmp.T2qZY9: line 13: systemctl: command not found
/var/tmp/rpm-tmp.T2qZY9: line 14: systemctl: command not found
,which means the stage where after successful installation the server gets started, has failed as systemctl is not present in centOS.
So my questions are:
- what is the best way to start the openCPU server ?
- how can i change the port as i don't have all ports open ?
- Is this approach of connecting remote openCPU server instance from browser feasible or am I in a wrong direction?
Any pointers would be very helpful.
Thanks in advance.
You can probably ignore this error. Does this work on your server?
curl http://localhost/opcu/info
What do you see if you run sudo apachectl restart?

Stop sharing a port on Ngrok

The Ngrok documentation mentions this example to share a local port on Internet.
Example: Open port 80 on your local machine to the internet
$ ngrok 80
How do I stop sharing this port if I would not want it to be accessed on the internet any more>
On windows machine go to command prompt:
taskkill /f /im ngrok.exe
killall ngrok from a script or the command line will kill all running ngrok tunnels that are running.
This is what worked for me. Ty #kkron.
First, you have to find the ngrok process id by $ top command.
After that, just run $ kill -9 {ngrok_id}
That's all :)
Stopping the ngrok port/tunnel
Simple Solution
If you are running ngrok normally, then use Ctrl+C (On Windows) or Cmd+C (On Mac) in ngrok command line.
(Check below if issue still persist)
Extended Solution
If the port does not stop/close normally or there are active ngrok sessions that are not responding, then use: killall ngrok
If the above does not work or the port is still running,
Fix ngrok in your system by setting up your auth code again by logging into https://dashboard.ngrok.com/get-started
Generate a new token on the dashboard (scroll down dashboard) to https://dashboard.ngrok.com/get-started/your-authtoken
Click on "reset authtoken", copy the auth-code, then go-to ngrok on command-line ngrok authtoken INSERT-YOUR-NEW-TOKEN-HERE
Then go to ngrok folder or use command line to delete the .ngrok configuration file and directory: ngrok.yml, to remove the old configuration effectively ending all the open ports, tunnels and sessions.
Simple as pressing ctrl+c. But I'm not sure if it closes any ports. The same happens as #user7032676 told.
You just have to stop ngrok for this.
Quick search process with grep
top | grep "ngrok"
My id was this, make sure to change with yours
kill -9 55636
If you like start again tunneling from working directory
ngrok http 3000
You should see (CTRL+C to quit) on the top right corner of your terminal, when you are running a ngrok session (Online).
Although in my case, CTRL+C wasn't working. Instead CTRL+ALT+C did the quitting for me.
Operating System: Ubuntu 20.04
For some reason whenever I launched the ngrok agent on windows, the terminal will shutdown and not stay open. I would have to go to the website to see the url for the website.
To shut it down I could not do ctrl-c. I simply went into task manager and deleted the process.
To access the task manager on windows do ctrl + alt + delete
Reboot the computer and all. Hope helped

Boot script execution order (rc.local)?

With some great help from another user on here I've managed to create a script which writes the necessary network configurations required to /etc/network/interfaces and allow public access to a DomU server.
I’ve placed this script in the /etc/rc.local file, and executed chmod u+x /etc/rc.local to enable it.
The server is a DomU Ubuntu server on the a host (Dom0). And rc.local doesn't seem to be executing before the network is brought up at boot/creation time.
So the configuration changes are being made to the /etc/network/interfaces file, but are not active once the boot process completes. I have to reboot once more before the changes take effect.
I've tried adding /etc/init.d/networking restart to the the end of the rc.local script (before exit 0), but with no joy.
I also tried adding the script to the S35networking file, but again without success.
Any advice or suggestions on getting this script to execute before the network device is brought up would be greatly appreciated.?

Resources