1

I am currently running an Ab Initio command from a ksh script. The process is giving me a return code of 127..

air sandbox run ${PSET_FILE_PATH} -SOURCE_DATA_DT ${LAST_DATE_CURR_MON} -AI_LOG_FILE ${LOG_FILE} >> ${LOG_FILE} 2>&1 &
    process_id=${$}
    sleep 60
    ps -e -oruser=UID -opid,ppid,vsz,args=CMD | grep "${USER}" | grep -v grep | grep -v 'ps '  > ${ENV_BASE}/cems/recovery/hltcheck/${USER}_startup_mem.txt
    wait ${process_id}
    RC=${?}
    [[ ${RC} -eq 0 ]] || End ERROR "Pset execution of creating mfs failed"
chepner
  • 497,756
  • 71
  • 530
  • 681

1 Answers1

2

The script is not doing what I think you want it to do.

  1. The return code "127" is because the wait ${process_id} command returns it since the process id received as argument is not a background process.
  2. The process id to wait for is not correct because the command process_id=${$} receives the PID of the current shell script instance. The correct thing would be to use process_id=$! which will assign the PID of the last process put in background.

The Retur

czvtools
  • 591
  • 2
  • 7