How can I disable timestamps on PM2? - pm2

I wanted to use see timestamps on my log output from pm2, so I stopped the process and started it again with:
pm2 start www --log-date-format "MM/DD HH:mm"
Which successfully gave me timestamps. I now want to turn them off, but restarting doesn't work.

You have to delete the process from PM2 with pm2 delete www and then add it back with pm2 start www.

Related

pm2 proper path for ecosystem.config.js

I would like to instruct pm2 to always read the global ecosystem.config.js in:
C:\ProgramData\pm2\ecosystem.config.js or
C:\ProgramData\pm2\my-pm2-apps.config.js
by a simplified name/command - meaning: If I go to the terminal as Administrator, and to a random folder e.g: C:\temp\ (but NOT C:\ProgramData\pm2) and I type
pm2 start my-pm2-apps
pm2 stop my-pm2-apps
etc.
it will do the same as:
pm2 start C:\ProgramData\pm2\ecosystem.config.js
pm2 stop C:\ProgramData\pm2\ecosystem.config.js
or
pm2 start C:\ProgramData\pm2\my-pm2-apps.config.js
pm2 stop C:\ProgramData\pm2\my-pm2-apps.config.js
etc.
At this time I see it done by a separate PowerShell script that is added to the Windows PATH env.var., but is there a more direct way with pm2 itself?

pm2 has multiple copies of an executable in its list

Here is the output of pm2 ls
Why are there multiple keys_server's and how can they be removed?
P.s. If anyone knows why the vertical bars are not being rendered properly feel free to pitch in
Looks like pm2 delete <id> works. After doing
pm2 delete 0
pm2 delete 2
The list is:

MySql container stuck at "Restarting..." on Dokku

I tried to create a new mySql database on my Dokku container.
Using
dokku mysql:create bookmarks
The container has been created, but it seems it is unable to start.
The command
# dokku mysql:list
NAME VERSION STATUS EXPOSED PORTS LINKS
bookmarks mysql:5.6.26 restarting - -
I am unable to stop, restart or destroy this container.
# dokku mysql:destroy bookmarks
! WARNING: Potentially Destructive Action
! This command will destroy bookmarks MySQL service.
! To proceed, type "bookmarks"
> bookmarks
-----> Deleting bookmarks
Deleting container data
! Service is already stopped
Removing container
Error response from daemon: Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f
Error: failed to remove containers: [dokku.mysql.bookmarks]
I also tried to reboot the entire server, without any success.
To me, it seems like something went wrong during the creation of this container that makes the system unable to start it. The problem is that at the same time I am unable to stop or restart it, and being unable to stop it I cannot remove it and start from scratch.
# dokku mysql:stop bookmarks
! Service is already stopped
# dokku mysql:restart bookmarks
! Service is already stopped
-----> Starting container
No container exists for bookmarks
-----> Please call dokku ps:restart on all linked apps
The error message says something about "forcing" the process, but I can't find anywhere how to use it.
Does anyone have any idea?
Thank you in advance,
Simone
So, finally with the help from people from DigitalOcean I've been able to stop and destroy that faulty container.
Here is what I did:
Check Docker processes running
docker ps -a
Identify the process that is causing the problem, in my case it was:
8549c8ec4e53 mysql:5.6.26 "/entrypoint.sh mysql" 17 hours ago Restarting (1) 2 hours ago 3306/tcp dokku.mysql.bookmarks
Kill the Docker process
docker kill 8549c8ec4e53
Remove the container from Dokku
dokku mysql:destroy bookmarks
Hope this answer helps others having similar problems.

Openshift Cronjob Not Running

I have tried to setup a simple cron job running on openshift but once I have pushed the file to openshift and then login and search for the file it does not seem to be there and there is not log output.
I created an application from: https://github.com/smarterclayton/openshift-go-cart
I then installed the cron 1.4 cartridge.
I created a file at .openshift/cron/minutely/awesome_job and set it as 755
I added the following contents:
#! /bin/bash
date > $OPENSHIFT_LOG_DIR/last_date_cron_ran
I pushed to the server
Logged in via ssh and run find /var/lib/openshift/53760892e0b8cdb5e9000b22 -name awesome_job for which it finds nothing.
Any ideas which might help as I am at loss why is it not working.
Make sure the execution bit is set on your cron file.
The issue was not with cron but with the golang cartridge I was using which was removing the .openshift directory.
https://github.com/smarterclayton/openshift-go-cart/issues/10
You should also put a file named "jobs.allow" under your .openshift/cron/minutely/. So your cron jobs will be executed.
For your ref: https://forums.openshift.com/daily-cron-jobs-not-getting-triggered-automatically
And the reason you can find your awesome_job vis ssh login is because it is under /var/lib/openshift/53760892e0b8cdb5e9000b22/app-root/runtime/repo/.openshift, so the command find does not search any files under folders named with . prefixed.

Gunicorn not reloading code completely with the HUP signal

I'm running gunicorn and I use the HUP signal to reload gunicorn gracefully. However, it seems that changes in models.py are not reloaded for some reason. To be specific I do:
sudo kill -HUP `cat masterpid`
I also run gunicorn with supervisor, so I end up doing a hard restart of gunicorn with supervisor, but it is not graceful and there is a second or two of downtime (plus some possibly broken requests). Does anyone have a solution for this?
Are you using run_gunicorn (now deprecated)?
https://github.com/benoitc/gunicorn/issues/536