Comparing a text file's entries with ps -ef output

Shell : Korn
os : AIX

This is the ps output looking for a process called pmon. pmon runs with various 'service' names which is appended with an underscore as shown below.

For example a pmon process for the service hexjkm will be named ora_pmon_hexjkm

$ ps -ef | grep pmon

  oracle  4128852        1   0   Nov 10      - 14:59 ora_pmon_hexjkm 
  oracle  4849792        1   0   Nov 10      - 15:04 ora_pmon_yevnes 
  oracle  7274610        1   0   Nov 10      - 20:50 ora_pmon_ceespr 
  oracle  7471232        1   0   Nov 10      - 23:25 ora_pmon_niclkn 
  oracle  8913076        1   0   Nov 10      - 19:12 ora_pmon_lmstpu 
  oracle 11403284        1   0   Nov 10      - 19:31 ora_pmon_cectpr 
  oracle 13107282        1   0   Nov 10      - 14:47 ora_pmon_cesass 
  oracle 15270050        1   0   Nov 10      - 19:30 ora_pmon_ukcocs 
  oracle 16318666        1   0   Nov 10      - 27:05 ora_pmon_fgcocs 
  oracle 16580818        1   0   Nov 10      - 14:53 ora_pmon_ceesbr 
  oracle 16646356        1   0   Nov 10      - 19:42 ora_pmon_plcocs 
  oracle 16711894        1   0   Nov 10      - 16:05 ora_pmon_ceboas 
  oracle 21364870        1   0   Nov 10      - 24:17 ora_pmon_cecocr 
  oracle 22741182        1   0   Nov 10      - 24:52 ora_pmon_ceclcr 
  oracle 24903694        1   0   Feb 16      -  4:56 ora_pmon_emcops 
  oracle 29032624        1   0   Feb 16      -  4:42 ora_pmon_emcopr 
  oracle 43122910        1   0   Mar 23      -  0:29 ora_pmon_cecmcr 
  oracle  6947270        1   0   Nov 10      - 17:45 ora_pmon_emcwar 
  oracle  7078360        1   0   Nov 10      - 18:43 ora_pmon_emcwas 
  oracle  7602490        1   0   Jan 06      - 13:37 ora_pmon_cetcnc 
  oracle  7930212        1   0   Nov 10      - 17:44 ora_pmon_ceurfs 
  oracle 38666612        1   0   Feb 21      -  8:55 ora_pmon_cecmcs 
  oracle 45809970        1   0   Mar 08      -  4:15 ora_pmon_wtcocs 
  oracle 63701382        1   0   Feb 24      -  7:38 ora_pmon_facuyr 
  oracle 16056858        1   0   Feb 15      -  5:08 ora_pmon_cecpcs 
  oracle 21824140        1   0   Mar 19      -  0:51 ora_pmon_lebtcs 
  oracle 52232842        1   0   Mar 08      -  2:41 ora_pmon_uedopl

Below is text file named mustRun.lst, which contains entries of service names.

$ cat mustRun.lst

yevnes
ceboas
ukcocs
plcocs
fgcocs
cecocr
cesass
ceurfs
cecpcs
ceclcr
ceesbr
cectpr
cecmcr
cecmcs
ceespr
niclkn
hexjkm
lebtcs
cetcnc
facuyr
lmstpu
emcwar
emcopr
emcwas
emcops
uedopl
wtcocs

Every morning I need to check a set of mandatory processes (listed in mustRun.lst) and make sure that it is running (ie. present in ps output)

So, I need to find the service names which are present in mustRun.lst file but absent from ps -ef output. Is there any way to do this using scripting ?

try something like below

ps -ef | grep pmon > psOracle.dat
awk  'FILENAME=="psOracle.dat"{A[$1]=$1} FILENAME=="mustRun.lst"{if(A[$1]!=$1){print}}' psOracle.dat mustRun.lst