Processes Command - Unix

For Processes:

If you are submitting SPSS batch jobs using large data sets you may find the next two commands handy.

Display process status:  ps

Terminate a process:  kill  PID

Occasionally you may begin a large batch job and then for some reason decide that you need to cancel the job. In UNIX this is a relatively simple operation, yet one that should not be done with undue frequency as there are risks involved. For example, when you invoke SPSS a short message will preceed your command. This contains your process id number.

% spss -m <first.sps >first.lis & 
[1] 5809
%

Terminating a process is quite simple if you remember this number. When you type the command kill followed by the process id number (PID) the job will be terminated at the point of interruption. This means if SPSS has all ready calculated half of your output before you terminated the job that half of the output will not be deleted, but will be located in the specified output file.

%    kill  5809
[1]    Terminated spss  -m<first.sps  >first.lis
%

If you forget the PID number and on that rare occasion need to know what it is, use the command ps. When you see the example below, you will notice that there are numerous jobs listed that you did not specifically request. Some of these are vital processes that UNIX automatically invokes.

BE CAREFUL NOT TO DELETE THE WRONG PROCESS! Again, it is best not to use the kill command unless absolutely necessary as there is risk involved.
When you see the information pulled up by ps, the only information that is critical is the PID.
 

% spss -m <first.sps >first.lis 
& [1] 5809 
% <<time  lapse  here>> 
% ps 

5809 ttyx12 0:00 spsscmd
5810 ttyx12 0:07 spss
5823 ttyx12 0:00 ps
4913 ttyx12 0:00 telnetd
4918 ttyx12 0:02 tcsh

% kill  5809 
[1]  Terminated spss  -m<first.sps  >first.lis

Have a Unix Problem
Unix Forum - Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.