src/daemon.js
function monitor() {
    if(!child.pid) {
      // If the number of periodic starts exceeds the max, kill the process
      if (starts >= options.maxRetries) {
        if ((Date.now() - startTime) > maxMilliseconds) {
          console.error(
            `Too many restarts within the last ${maxMilliseconds / 1000} seconds. Please check the script.`
          )
          process.exit(1)
        }
      }

      setTimeout(() => {
        wait = wait * options.growPercentage
        attempts += 1;
        if (attempts > options.maxRestarts && options.maxRestarts >= 0){
          console.error(
            `${options.name} will not be restarted because the maximum number of total restarts has been exceeded.`
          )
          process.exit()
        } else {
          launch()
        }
      }, wait)
    } else {
      attempts = 0
      wait = options.restartDelay * 1000
    }
  }
function monitor() {
    if(!child.pid) {
      // If the number of periodic starts exceeds the max, kill the process
      if (starts >= options.maxRetries) {
        if ((Date.now() - startTime) > maxMilliseconds) {
          console.error(
            `Too many restarts within the last ${maxMilliseconds / 1000} seconds. Please check the script.`
          )
          process.exit(1)
        }
      }

      setTimeout(() => {
        wait = wait * options.growPercentage
        attempts += 1;
        if (attempts > options.maxRestarts && options.maxRestarts >= 0){
          console.error(
            `${options.name} will not be restarted because the maximum number of total restarts has been exceeded.`
          )
          process.exit()
        } else {
          launch()
        }
      }, wait)
    } else {
      attempts = 0
      wait = options.restartDelay * 1000
    }
  }
function monitor ( ) { if ( ! child . pid ) { // If the number of periodic starts exceeds the max, kill the process if ( starts >= options . maxRetries ) { if ( ( Date . now ( ) - startTime ) > maxMilliseconds ) { console . error ( ` ${ maxMilliseconds / 1000 } ` ) process . exit ( 1 ) } } setTimeout ( ( ) => { wait = wait * options . growPercentage attempts += 1 ; if ( attempts > options . maxRestarts && options . maxRestarts >= 0 ) { console . error ( ` ${ options . name } ` ) process . exit ( ) } else { launch ( ) } } , wait ) } else { attempts = 0 wait = options . restartDelay * 1000 } }
Monitor the process to make sure it is running
Monitor the process to make sure it is running