failat 9999999
changetaskpri 0

rx "exit show('p','JAMMAIL')"
if ${RC} eq 1
  echo "Killing Current Running JamMail!"
  rx >nil: "Address 'JAMMAIL' 'Abort'"
endif
rx "exit show('p','JAMMAIL5')"
if ${RC} eq 1
  echo "Killing Current Running Line 5!"
  rx >nil: "Address 'JAMMAIL5' 'Abort'"
endif
rx "exit show('p','JAMMAIL8')"
if ${RC} eq 1
  echo "Killing Current Running Line 8!"
  rx >nil: "Address 'JAMMAIL8' 'Abort'"
endif
rx "exit show('p','JAMMAIL3')"
if ${RC} eq 1
  echo "Killing Current Running Line 3!"
  rx >nil: "Address 'JAMMAIL3' 'Abort'"
endif
rx "exit show('p','LOGPROC')"
if ${RC} eq 0
  run <NIL: >nil: logproc
  wait 2
  echo "Waiting for LogProc"
  waitforport LOGPROC
  rx "Address 'LOGPROC' 'OpenLog jammailfile f Logs:JamMail.log'"
  rx "Address 'LOGPROC' 'OpenLog jammailwind w RAW:0/13/640/198/JamMail Log Window/inactive/SCREENJamLogs'"
  rx "Address 'LOGPROC' 'AddLogGroup JamMailLogs jammailwind jammailfile'"

  rx "Address 'LOGPROC' 'OpenLog jm-phonefile f logs:phone.log'"
  rx "Address 'LOGPROC' 'AddLogGroup JamMailPhone jm-phonefile'"
else
  Echo "Logging system already active"
endif
if NOT EXISTS logs:phone.log
  echo  >logs:phone.log "   Date     Time   Duration     Number    Type      Address        Location"
  echo >>logs:phone.log "--------- -------- -------- -------------- ---- ------------------- ---------"
endif
echo "Launching JAMMAIL"

newshell window=RAW:402/13/300/90/Setup/inactive/SCREENJamLogs from s:setup.cli

