Skip to content

Commit 0489f4d

Browse files
committed
use process list
1 parent 5c07167 commit 0489f4d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

mailcatcher.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public function __construct() {
2222
$hcpp->add_action( 'priv_unsuspend_domain', [ $this, 'priv_unsuspend_domain' ] );
2323
$hcpp->add_action( 'hcpp_plugin_installed', [ $this, 'hcpp_plugin_installed' ] );
2424
$hcpp->add_action( 'hcpp_new_domain_ready', [ $this, 'hcpp_new_domain_ready' ] );
25-
$hcpp->add_action( 'hcpp_rebooted', [ $this, 'hcpp_rebooted' ] );
2625
}
2726

2827
// Set MAILCATCHER_DOMAIN for PM2 started processes
@@ -75,20 +74,15 @@ public function setup( $user, $domain ) {
7574
$this->start();
7675
}
7776

78-
// Start mailcatcher
77+
// Start mailcatcher and save the process list
7978
public function start() {
8079
$cmd = 'if ! runuser -s /bin/bash -l "mailcatcher" -c "cd /opt/mailcatcher && export NVM_DIR=/opt/nvm && source /opt/nvm/nvm.sh && pm2 list" | grep -q "mailcatcher_app"; ';
81-
$cmd .= 'then runuser -s /bin/bash -l "mailcatcher" -c "cd /opt/mailcatcher && export NVM_DIR=/opt/nvm && source /opt/nvm/nvm.sh ; pm2 start mailcatcher.config.js"; fi';
80+
$cmd .= 'then runuser -s /bin/bash -l "mailcatcher" -c "cd /opt/mailcatcher && export NVM_DIR=/opt/nvm && source /opt/nvm/nvm.sh ; pm2 start mailcatcher.config.js" ; pm2 save --force; fi';
8281
global $hcpp;
8382
$cmd = $hcpp->do_action( 'mailcatcher_start', $cmd );
8483
$hcpp->log( shell_exec( $cmd ) );
8584
}
86-
87-
// Start mailcatcher on reboot
88-
public function hcpp_rebooted() {
89-
$this->start();
90-
}
91-
85+
9286
public function priv_unsuspend_domain( $args ) {
9387
$user = $args[0];
9488
$domain = $args[1];

0 commit comments

Comments
 (0)