Autosys command to identify jobs which are ON ICE | ON HOLD - autosys

under Migration process, we need to identify the commands/box which are kept ON HOLD/ON ICE. We are doing this activity as we need to delete those unused jobs.
Please let me know the Autosys command to list these unused jobs?
Thanks

If you're doing this manually, then a simple grep/find should work for you, for example:
in Unix:
autorep -wj ALL | grep OI
autorep -wj ALL | grep OH
or in a Windows agent CMD:
autorep -wj ALL | find "OI" or OH for on_hold jobs
However, if you plan to automate this, you can write a simple program that uses the above commands as a base, then parse the output.

Related

Using grep and wc to search and count matching processes

I am using ps to list all of the processes running on the machine I am connected to, searching them for my own processes, and then printing the number of processes I am running, like so:
ps -Af | grep '^mkuhlman' | wc -l
Problem is, checking against the actual list of processes, I'm only running 8, but wc is listing 9 processes. What am I doing wrong?
To clarify, I am not looking for matches to processes, but matches to my own username.
Your pipeline has a few processes, and you're counting them.
Running ps is fine, but you might be happier with pgrep. It has a man page. (And ps -A seems at odds with grepping for your own username.)
Though grep -v grep would work in most cases, it can result in wrong output as it excludes all grep processes, not just the ones related to the ps command line. So, you could do this instead:
ps -Af | grep -E '^mkuhlman|__unique__' | grep -v __unique__
where __unique__ is a unique string that is unlikely to be used in the command line of other user processes.
See also:
Finding process count in Linux via command line

get all recent job failures in Autosys

What's a command to list all recent failures in Autosys?
I was thinking of autorep -d -J ALL followed by some kind of grep, but the autorep report comes in paragraphs, with the job name and the status in separate lines, so I need to write a custom filter in Perl unless I'm overlooking some quick and simple option.
Use spaces in the search of the output of autorep for failed jobs, i.e. grep " FA ".
The -d flag is giving details, which is why autorep is producing paragraph-like output. Running autorep -J ALL | grep "FA" or similar should give you the listing just fine.
Lets say all your jobs start with a common database prefix.
CRANE_job1
CRANE_job2
and so on..
Use:
aj CR% |grep -w FA

What is difference between a job and a process in Unix?

What is the difference between a job and a process in Unix ? Can you please give an example ?
Jobs are processes which are started by a shell. The shell keeps track of these in a job table. The jobs command shows a list of active background processes. They get a jobspec number which is not the pid of the process. Commands like fg use the jobspec id.
In the spirit of Jürgen Hötzel's example:
find $HOME | sort &
[1] 15317
$ jobs
[1]+ Running find $HOME | sort &
$ fg
find $HOME | sort
C-c C-z
[1]+ Stopped find $HOME | sort
$ bg 1
[1]+ find $HOME | sort &
Try the examples yourself and look at the man pages.
A Process Group can be considered as a Job. For example you create a background process group in shell:
$ find $HOME|sort &
[1] 2668
And you can see two processes as members of the new process group:
$ ps -p 2668 -o cmd,pgrp
CMD PGRP
sort 2667
$ ps -p "$(pgrep -d , -g 2667)" -o cmd,pgrp
CMD PGRP
find /home/juergen 2667
sort 2667
You can can also kill the whole process group/job:
$ pkill -g 2667
http://en.wikipedia.org/wiki/Job_control_%28Unix%29:
Processes under the influence of a job control facility are referred to as jobs.
http://en.wikipedia.org/wiki/Job_control_%28Unix%29
Jobs are one or more processes that are grouped together as a 'job', where job is a UNIX shell concept.
Jobs are one or more processes that are grouped together as a 'job', where job is a UNIX shell concept. A job consists of multiple processes running in series or parallel. while
A process is a program under execution. job is when you want to know about processes started from the current shell.
A job consists of multiple processes running in series or parallel. A process is a program under execution.
job is when you want to know about processes started from the current shell.
process is when you want to know about a process running from any shell or computer.
I think a job is a scheduled process or set of processes, a job always has the notion of schedule, otherwise we could call it a process.

piping in UNIX doubt

In The Unix Programming Environment by K & P, it is written that
" The programs in a pipeline actually run at the same time, not one after another.
This means that programs in a pipeline can be interactive;"
How can programs run at same time?
For ex: $ who | grep mary | wc -l
How grep mary will be executed until who is run or how wc -l will be executed until it
knows results of previous programs?
All three programs will start. grep and wc wait for input via stdin
who will output a line of data, which grep will then receive
If the line matches, grep will write it to stdout, which wc will then read and count
In the meantime, who may also have been writing out more data for grep etc
Each program needs the results of the previous one, but it doesn't need all of the results before it can start working, which is why pipelining is feasible.

List and kill at jobs on UNIX

I have created a job with the at command on Solaris 10.
It's working now but I want to kill it but I don't know how I can find the job number and how to kill that job or process.
You should be able to find your command with a ps variant like:
ps -ef
ps -fubob # if your job's user ID is bob.
Then, once located, it should be a simple matter to use kill to kill the process (permissions permitting).
If you're talking about getting rid of jobs in the at queue (that aren't running yet), you can use atq to list them and atrm to get rid of them.
To delete a job which has not yet run, you need the atrm command. You can use atq command to get its number in the at list.
To kill a job which has already started to run, you'll need to grep for it using:
ps -eaf | grep <command name>
and then use kill to stop it.
A quicker way to do this on most systems is:
pkill <command name>
at -l to list jobs, which gives return like this:
age2%> at -l
11 2014-10-21 10:11 a hoppent
10 2014-10-19 13:28 a hoppent
atrm 10 kills job 10
Or so my sysadmin told me, and it
First
ps -ef
to list all processes. Note the the process number of the one you want to kill. Then
kill 1234
were you replace 1234 with the process number that you want.
Alternatively, if you are absolutely certain that there is only one process with a particular name, or you want to kill multiple processes which share the same name
killall processname

Resources