I use pm2 to deal with node projects. Even when all projects are stopped via pm2, I see that pm2 God Daemon is always running and consuming about ~27M Ram. Here how it looks on ps aux:
nodeuser 2577 ? Ssl 18:02 0:01 PM2 v0.15.10: God Daemon
The question is, is it built to be that way? Should pm2 God Daemon always be running? However if it is the case, I would like to know why because it didn't make sense to me.
Can I kill pm2 God Daemon via pm2? Or simply kill with kill -9 pid?
With pm2 you can kill the god daemon with
pm2 kill
Related
Without any containers running, when I do a ps on the host, there is a process named podman.
[ec2-user#ip-172-31-26 ~]$ ps auxf
...
ec2-user 6164 0.0 0.6 66096 24020 ? S 14:40 0:00 podman
I know podman is daemon-less, unlike Docker. If that's the case, what is the use for the lingering podman process?
I thought the way podman worked, was when you started a container, the process running your command forks off a separate process for the container. So I would've expected no lingering parent/stand-alone process.
Got IPFS installed on a new computer and got problems running:
ipfs deamon
It returns Error: lock /Users/yenan/.ipfs/repo.lock: someone else has the lock
This wasn't a problem on a previous computer. Thanks
If the file repo.lock exists, it normally means that the IPFS daemon is already running. It could also be left over from an IPFS daemon that was terminated without letting it shut down properly (e. g. with kill -9).
Make sure that no IPFS processes are running, then remove the lock file manually and restart the daemon:
killall ipfs
rm /Users/yenan/.ipfs/repo.lock
ipfs daemon
I have a Docker machine, and I want it to be able to use port 3306. But that port is already in use.
I don't remember installing MySQL on the host machine, but I've done a lot of dumb things over the years, so there's a good chance I did. I run brew services list to see if it's a brew service that is blocking the port. Nope. Nothing is listed.
So I run sudo lsof -i tcp:3306 and get the following:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 71046 _mysql 28u IPv6 0xbdab224a8a9b989f 0t0 TCP *:mysql (LISTEN)
OK. Simple to kill, right? I run sudo kill -QUIT 71046 and run sudo lsof -i tcp:3306 again. Now there's a different process listening on the same port:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 71207 _mysql 28u IPv6 0xbdab224a8a9ba41f 0t0 TCP *:mysql (LISTEN)
This process goes on as many times as I care to repeat it. Trying to run mysql or mysqld runs into a command not found error.
So my question: What command do I have to run to permanently stop mysqld from respawning ad infinitum?
(Bonus points if you can help me get rid of the setting that starts it automatically when my machine starts.)
I gave a comment above that led you to the answer, but here's a more full explanation for the benefit of future readers:
I infer you are on MacOS because you mention brew. MacOS is weird because there are multiple ways to run MySQL Server. Brew is one of them, but the official download from MySQL.com uses a native package installer, and creates a launch daemon and a System Preferences pane to manage the launch daemon.
https://dev.mysql.com/doc/refman/5.7/en/osx-installation-prefpane.html
You can use the preferences pane to start and stop the launch daemon, or enable/disable its automatic startup.
i'm trying to create a shell script to stop and start mysql and httpd every saturday on 3am, i'm doing it:
myscript.sh:
#!/bin/sh
echo "Stopping MySQL"
service mysqld stop
sleep 1s
echo "Stopping HTTPD"
service httpd stop
sleep 5s
echo "Starting MySQL"
service mysqld start
sleep 2s
echo "Starting HTTPD"
service httpd start
and setting the crontab to:
0 3 * * 6 ~/myscript.sh
It's correct way to do it? i'm stopping and starting mysql and httpd cuz use of memory, should i do some check before stop them? or i can do it without problems?
another question: how to check memory ram before stop them? like a 'if' memory is less than X stop them, something like it?
Thanks in advanced.
Presumably your MySQL workload comes from your httpd web server.
So, do this, to stop httpd first, then bounce mysqld, then restart httpd.
service httpd stop
sleep 10s
service mysqld restart
service httpd start
But, you should investigate carefully whether this is truly necessary. Lots of production systems don't need it. Modern Apache servers limit the lifetime of their worker processes automatically, to handle the memory leak situation you are mentioning.
I have scenario in which i want gunicorn workers to acknowledge and fulfill ongoing requests before supervisord starts after stopping(restart).
Can anyone help me with this.
Set your Supervisor configuration as autostart and autorestart as true.
Then kill the gunicorn by
kill -HUP `cat /tmp/process.pid`
It will shutdown gracefully hence processing all requests and supervisor will restart it according to the configurations.
You can also use reload of gunicorn as it sends HUP signal.
More precisely, you can to reload your app by sending HUP signal by: pkill -HUP gunicorn.
Because the /var/run/ directory is missing this pid:
find /var/run/ -iname '*gunicorn*' | wc -l
0
See the official Gunicorn docs, http://docs.gunicorn.org/en/stable/faq.html
and man 1 pkill