File tree 3 files changed +13
-4
lines changed
3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ commander.version(pkg.version)
44
44
. option ( '--gid <gid>' , 'run target script with <gid> rights' )
45
45
. option ( '--cwd <path>' , 'run target script as <username>' )
46
46
. option ( '--hp <home path>' , 'define home path when generating startup script' )
47
+ . option ( '--service-name <name>' , 'define service name when generating startup script' )
47
48
. option ( '-c --cron <cron_pattern>' , 'restart a running process based on a cron pattern' )
48
49
. option ( '-w --write' , 'write configuration in local folder' )
49
50
. option ( '--interpreter <interpreter>' , 'the interpreter pm2 should use for executing app (bash, python...)' )
Original file line number Diff line number Diff line change @@ -64,9 +64,9 @@ module.exports = function(CLI) {
64
64
var that = this ;
65
65
var actual_platform = detectInitSystem ( ) ;
66
66
var user = opts . user || process . env . USER ;
67
- var service_name = 'pm2-' + user ;
67
+ var service_name = ( opts . serviceName || 'pm2-' + user ) ;
68
68
var openrc_service_name = 'pm2' ;
69
- var launchd_service_name = 'pm2.' + user ;
69
+ var launchd_service_name = ( opts . serviceName || 'pm2.' + user ) ;
70
70
71
71
if ( ! platform )
72
72
platform = actual_platform ;
@@ -166,9 +166,9 @@ module.exports = function(CLI) {
166
166
var that = this ;
167
167
var actual_platform = detectInitSystem ( ) ;
168
168
var user = ( opts . user || process . env . USER ) ;
169
- var service_name = 'pm2-' + user ;
169
+ var service_name = ( opts . serviceName || 'pm2-' + user ) ;
170
170
var openrc_service_name = 'pm2' ;
171
- var launchd_service_name = 'pm2.' + user ;
171
+ var launchd_service_name = ( opts . serviceName || 'pm2.' + user ) ;
172
172
173
173
if ( ! platform )
174
174
platform = actual_platform ;
Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ SRC=$(cd $(dirname "$0"); pwd)
10
10
source " ${SRC} /include.sh"
11
11
12
12
cd $file_path
13
+ $pm2 startup upstart -u $USER --hp $HOME --service-name abcdef
14
+ spec " should startup command generation exited succesfully with custom service-name"
15
+ test -e /etc/init.d/abcdef
16
+ spec " should have generated upstart file with custom service-name"
17
+ $pm2 unstartup upstart --service-name abcdef
18
+ spec " should have disabled startup with custom service-name"
19
+ ! test -e /etc/init.d/abcdef
20
+ spec " should have deleted upstart file with custom service-name"
13
21
14
22
$pm2 startup upstart -u $USER --hp $HOME
15
23
spec " should startup command generation exited succesfully"
You can’t perform that action at this time.
0 commit comments