1) how to find the shellscript which is running In background is completed or not ?
ex: I know the shellscript name abc.sh which is running in background through cronjob. I want to know this is job is still running or stopped, how to check this ?
which will give you a zero exit status if one or more copies of processes are running with a name containing the string abc.sh . Using [.] instead of just . gets rid of the need for grep -v grep and keeps strings like abcdsh from accidentally being selected.
If there might be other processes running that are named with a longer string containing abc.sh , you can avoid that problem with the more complex:
ps -ef | grep -Eq '( |/)abc[.]sh( |$)'
Note that none of these suggestions will keep this from mistakenly indicating that abc.sh is running if any process is running with an argument that is abc.sh .