diff --git a/.changelogrc b/.changelogrc index 2d0e491e..14a1a689 100644 --- a/.changelogrc +++ b/.changelogrc @@ -4,8 +4,8 @@ "intro": "", "branch" : "master", "repo_url": "https://github.com/Unitech/pm2", - "version_name" : "v2.10.2", - "tag": "2.10.1", + "version_name" : "2.10.4", + "tag": "2.10.3", "file": "currentTagChangelog.md", "template": "changelogTemplate.md", "sections": [ diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index b6ddb7c1..113fee12 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,5 +1,7 @@ + ## What's going wrong? @@ -7,8 +9,9 @@ Please search on the [issue tracker](https://github.com/Unitech/pm2/search?type= ## Supporting information + ``` $ pm2 report ``` diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c94ce3c9..9896e87f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,6 @@ + | Q | A | ------------- | --- | Bug fix? | yes/no @@ -10,5 +11,6 @@ Please always submit pull requests on the development branch. | Fixed tickets | #1234, #5678 | License | MIT | Doc PR | https://github.com/pm2-hive/pm2-hive.github.io/pulls - + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bdfaa39c..fbd96fd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,32 @@ +## 2.10.4 ( Thu May 17 2018 14:32:40 GMT+0200 (CEST) ) + + +## Bug Fixes + - #3645 throttle startup + ([d529f675](https://github.com/Unitech/pm2/commit/d529f675d0240777cba95442ba35205c370cdb43)) + + + + +## Chore + - update issue and PR templates to use comments to hide instructions in the frontend + ([9e0180ed](https://github.com/Unitech/pm2/commit/9e0180eddab071916144ad7008817bd6aef1c8ce)) + + + + +## Pull requests merged + - Merge pull request #3664 from DanielRuf/chore/update-issue-pr-templates + ([067446f2](https://github.com/Unitech/pm2/commit/067446f2133ba7f761b0ad3c9f3692b167affd8b)) + + +## v2.10.3 ( Fri Apr 27 2018 11:42:16 GMT+0200 (CEST) ) + + +### Chore + - upgrade for node 10 + ([cf7630e](https://github.com/Unitech/pm2/commit/cf7630e259742bdff8257cff4dbed2732bf24f9c)) + ## v2.10.2 ( Thu Mar 29 2018 13:06:11 GMT+0200 (CEST) ) @@ -15,7 +44,7 @@ ([438e3030](https://github.com/Unitech/pm2/commit/438e303013e82ecc199cb68d018144cde8a0b2e6)) - Merge pull request #3532 from N-Nagorny/logs-smart-app-name-cutting ([067c18e6](https://github.com/Unitech/pm2/commit/067c18e601aca4fac10101a7c23cc4c3525ad776)) - + ## v2.10.1 ( Mon Feb 26 2018 11:38:18 GMT+0100 (CET) ) diff --git a/README.md b/README.md index 6555ac7b..445b4e9c 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Your app is now daemonized, monitored and kept alive forever. ### Container Support With the drop-in replacement command for `node`, called `pm2-runtime`, run your Node.js application in a proper production environment. -We also offer an [officialy supported Docker image](https://hub.docker.com/r/keymetrics/pm2/). +There is also an [officialy supported Docker image](https://hub.docker.com/r/keymetrics/pm2/). Using it is seamless: diff --git a/lib/API/Startup.js b/lib/API/Startup.js index e27469c1..08d487c3 100644 --- a/lib/API/Startup.js +++ b/lib/API/Startup.js @@ -221,12 +221,21 @@ module.exports = function(CLI) { else template = getTemplate('systemd'); destination = '/etc/systemd/system/' + service_name + '.service'; + commands = [ - 'systemctl enable ' + service_name, - 'systemctl start ' + service_name, - 'systemctl daemon-reload', - 'systemctl status ' + service_name - ]; + 'systemctl enable ' + service_name + ] + + try { + fs.readFileSync(cst.PM2_PID_FILE_PATH).toString() + } catch(e) { + commands = [ + 'systemctl enable ' + service_name, + 'systemctl start ' + service_name, + 'systemctl daemon-reload', + 'systemctl status ' + service_name + ] + } break; case 'ubuntu14': case 'ubuntu12': @@ -315,10 +324,10 @@ module.exports = function(CLI) { Common.printOut(cst.PREFIX_MSG + 'Making script booting at startup...'); async.forEachLimit(commands, 1, function(command, next) { - Common.printOut(chalk.bold('>>> Executing %s'), command); + Common.printOut(cst.PREFIX_MSG + '[-] Executing: %s...', chalk.bold(command)); require('shelljs').exec(command, function(code, stdout, stderr) { if (code === 0) { - Common.printOut(chalk.bold('[DONE] ')); + Common.printOut(cst.PREFIX_MSG + chalk.bold('[v] Command successfully executed.')); return next(); } else { Common.printOut(chalk.red('[ERROR] Exit code : ' + code)) diff --git a/lib/Daemon.js b/lib/Daemon.js index c1d7019f..95eee01b 100644 --- a/lib/Daemon.js +++ b/lib/Daemon.js @@ -271,6 +271,10 @@ Daemon.prototype.close = function(opts, cb) { } } + try { + fs.unlinkSync(that.pid_path); + } catch(e) {} + console.log('PM2 successfully stopped'); setTimeout(function() { process.exit(cst.SUCCESS_EXIT); @@ -282,10 +286,10 @@ Daemon.prototype.close = function(opts, cb) { Daemon.prototype.handleSignals = function() { var that = this; - process.on('SIGTERM', that.gracefullExit); - process.on('SIGINT', that.gracefullExit); + process.on('SIGTERM', that.gracefullExit.bind(this)); + process.on('SIGINT', that.gracefullExit.bind(this)); process.on('SIGHUP', function() {}); - process.on('SIGQUIT', that.gracefullExit); + process.on('SIGQUIT', that.gracefullExit.bind(this)); process.on('SIGUSR2', function() { God.reloadLogs({}, function() {}); }); @@ -313,6 +317,11 @@ Daemon.prototype.sendReady = function(cb) { Daemon.prototype.gracefullExit = function() { var that = this; + God.bus.emit('pm2:kill', { + status : 'killed', + msg : 'pm2 has been killed by SIGNAL' + }); + console.log('pm2 has been killed by signal, dumping process list before exit...'); God.dumpProcessList(function() { @@ -324,13 +333,14 @@ Daemon.prototype.gracefullExit = function() { God.deleteProcessId(proc.pm2_env.pm_id, function() { return next(); }); - return false; }, function(err) { try { fs.unlinkSync(that.pid_path); } catch(e) {} - console.log('Exited peacefully'); - process.exit(0); + setTimeout(function() { + console.log('Exited peacefully'); + process.exit(cst.SUCCESS_EXIT); + }, 2); }); }); } diff --git a/package.json b/package.json index de0d4d7d..f504ef95 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pm2", "preferGlobal": true, - "version": "3.0.0", + "version": "3.0.0-alpha1", "engines": { "node": ">=4.0.0" },