How to auto-resurrect pm2 after system restart - pm2

I have set up the jobs in pm2 and used command pm2 save. If the server unfortunately crashed and restarted, i had to check and manually run pm2 resurrect to restart all saved jobs.
Is there any solution that whenever server reboots pm2 resurrect is automatically called?

If you are using windows server, you could add a script in task scheduler that runs on boot:
SET PM2_HOME=D:\PATH\TO\PM2\DIRECTORY
pm2 resurrect

Related

Stopping Bitnami WAMP Apache and MySQL server through PowerShell script in Windows

I've trying to write a script to stop Apache and MySQL services in Bitnami WAMP. If we do manually, we have to open C:\WAMP\manager-windows.exe and stop the services like this:
However, when I go into command prompt and run the command "httpd -k start", the apache server starts running and I can access my web app but if I open manager-windows.exe again it doesn't reflect the change. I've been also trying to stop the Apache service using command prompt commands "httpd -k stop" but that is somehow conflicting with Apache web server when it is started through the manager-windows.exe.
Bitnami Engineer here,
You can use the servicerun.bat script we include in the installation directory to start/stop all the services at once.
servicerun.bat START
If you only want to start/stop Apache or MySQL using the command prompt, you can use the scripts we include at installdir/apache2/scripts/servicerun.bat or installdir/mysql/scripts/servicerun.bat

Mac Gerrit Setup

Trying to install Gerrit on a Mac that has also Jenkins installed. So far:
Installed MySQL via Brew successfully.
Added user & db for Gerrit to MySQL.
D/l of gerrit.war from https://gerrit-releases.storage.googleapis.com/index.html
Installed gerrit.war into ~/Applications/Gerrit
Set canonicalWebUrl to http://localhost:8080/gerrit/ in gerrit.config
Restart Gerrit with ~/Applications/Gerrit/bin/gerrit.sh restart
But restart fails. There seems to be no consistent Mac Gerrit setup guide whatsoever and I feel I'm stuck with this issue.
Gerrit error_log says:
ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
java.lang.IllegalStateException: Cannot start HTTP daemon
Has anyone running this config on a Mac and can give me some help?
on a Mac that has also Jenkins installed
Most likely the cause is that Jenkins is already running on the same port (8080). Try to change Gerrit's canonicalWebUrl to another port (or change Jenkins' port).

Laravel 5.4 queue:restart on windows?

I am learning laravel 5.4 "queues" chapter. I have a problem about queue:restart command. Because when I test it on my windows 10 platform, I found this command seems just kill queue worker, but not restart worker. So I wonder whether this command does not work on windows or this command is just kill worker but not restart worker? Thanks.
The queue:restart command never actually restarts a worker, it just tells it to shutdown. It is supposed to be combined with a process manager like supervisor that will restart the process when it quits. This also happens when queue:work hits the configured memory limits.
To keep the queue:work process running permanently in the background, you should use a process monitor such as Supervisor to ensure that the queue worker does not stop running.
Source: https://laravel.com/docs/5.4/queues#running-the-queue-worker

Openshift hooks during gear restart

When I deploy my app with Jenkins or restart app with app_ctl action_hooks are executed. But when I restart application with rhc app restart app_name actions_hooks are not executed. I set up custom JVM parameters in actions_hooks. What I am doing wrong or how to solve this somehow? Using JBoss EWS 2.0 (Tomcat 7) cartridge.
Try doing an rhc app stop & rhc app start instead of restart, start/stop action hooks are not executed on a restart i believe.

nginx - Can I add a new virtual host without restarting the server?

Can I set a new virtual host using the server object in the nginx.conf configuration file, without restarting the server (and without closing the active connections)?
Thanks
Yes you can.
nginx -s reload
Or you can send SIGHUP to the nginx process.
sudo kill -HUP [nginx's pid]
You can Load New Configuration Using Signals. It will
Read and test a new configuration. If the configuration invalid then do nothing.
When valid, start new processing workers with new configuration. Attach new workers to port listening, log, etc.
Detach old workers from listeners.
Gracefully shutdown old workers.
You can even Upgrade To a New Binary On The Fly. See the same doc.
To perform the reload, send the reload signal:
nginx -s reload