Skip to content

Commit 28f11b9

Browse files
committed
#3347 --wait-ip option to override systemd script for waiting full internet connectivity
1 parent 02be631 commit 28f11b9

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- #3273 pm2 --mini-list now print the right pid file
1212
- #3206 add flag to auto turn off auto exit with pm2-docker
1313
- #3036 Fix applying env PM2_CONCURRENT_ACTIONS correctly
14+
- #3346 do not chmod systemd script (was failing systemd script on orange pi)
15+
- #3347 Add --wait-ip option to override systemd initialization to wait for internet full connectivity
1416

1517
## 2.8.0
1618

bin/pm2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ commander.version(pkg.version)
5454
.option('--gid <gid>', 'run target script with <gid> rights')
5555
.option('--cwd <path>', 'run target script as <username>')
5656
.option('--hp <home path>', 'define home path when generating startup script')
57+
.option('--wait-ip', 'override systemd script to wait for full internet connectivity to launch pm2')
5758
.option('--service-name <name>', 'define service name when generating startup script')
5859
.option('-c --cron <cron_pattern>', 'restart a running process based on a cron pattern')
5960
.option('-w --write', 'write configuration in local folder')

lib/API/Startup.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ module.exports = function(CLI) {
217217
case 'arch':
218218
case 'oracle':
219219
case 'systemd':
220-
template = getTemplate('systemd');
220+
if (opts.waitIp)
221+
template = getTemplate('systemd-online');
222+
else
223+
template = getTemplate('systemd');
221224
destination = '/etc/systemd/system/' + service_name + '.service';
222225
commands = [
223226
'systemctl enable ' + service_name,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[Unit]
2+
Description=PM2 process manager
3+
Documentation=https://pm2.keymetrics.io/
4+
After=network.target network-online.target
5+
Wants=network-online.target
6+
7+
[Service]
8+
Type=forking
9+
User=%USER%
10+
LimitNOFILE=infinity
11+
LimitNPROC=infinity
12+
LimitCORE=infinity
13+
Environment=PATH=%NODE_PATH%:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
14+
Environment=PM2_HOME=%HOME_PATH%
15+
PIDFile=%HOME_PATH%/pm2.pid
16+
17+
ExecStart=%PM2_PATH% resurrect
18+
ExecReload=%PM2_PATH% reload all
19+
ExecStop=%PM2_PATH% kill
20+
21+
[Install]
22+
WantedBy=multi-user.target network-online.target

0 commit comments

Comments
 (0)