Sponsored Content
Top Forums Shell Programming and Scripting check if job still alive and killing it after a certain walltime Post 79346 by ciwstevie on Wednesday 27th of July 2005 07:04:56 AM
Old 07-27-2005
That's how it worked out

Here's the code that made it finally work....although I have to admit that it wasn't me who did it...thanks Steve Smilie

./My_process.e &
pid=`ps -ef | grep $$ | grep My_process.e | grep -v grep | awk '{print $2}'`
count=0
Walltime=30
while kill -0 $pid 2> /dev/null
do
sleep 1
count=`expr $count + 1`
if [ $count -gt $Walltime ] ; then
kill -TERM $pid 2> /dev/null
break
fi
done

Maybe somebody might make use of it as well....

Best regards,

CIWStevie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

killing unix job after the job process completes

Hi, Thanks in advance. i need to kill a unix background running job after that job process completes. i can kill a job by giving the following unix command kill -9 processid how to kill the job after the current process run gets completed ? Appreciate your valuable help. ... (1 Reply)
Discussion started by: dtazv
1 Replies

2. Solaris

killing a unix job after the job process gets completed

Hi, Thanks in advance. i need to kill a unix background running job after that job process completes. i can kill a job by giving the following unix command kill -9 processid how to kill the job after the current process run gets completed ? Appreciate your valuable help. Thanks... (7 Replies)
Discussion started by: dtazv
7 Replies

3. Shell Programming and Scripting

Killing an Xterm while leaving subprocess alive...

Hi, I'm not quite understanding what I'm doing (happens often). This pseudocode works: #!/bin/pseudoksh function kill_parent { when i_want_to ; do sleep 2 kill -TERM $PPID exit done } kill_parent & ssh remote_host sh <<-EOF ... (0 Replies)
Discussion started by: mschwage
0 Replies

4. UNIX for Dummies Questions & Answers

Check whether a process is alive or not

Hi Everybody I have small requirement that needs to be implemented in shell script. Currently i have shell script which invokes a java process say "Process A" which runs in background. If some one tries to invoke again the same shell script , then there should be some mechanism inside the... (23 Replies)
Discussion started by: appleforme1415
23 Replies

5. Shell Programming and Scripting

How to check if a pid is alive?

I want to do some operations provided the pid is active. (6 Replies)
Discussion started by: ScriptDummy
6 Replies

6. UNIX for Dummies Questions & Answers

Keep Server Alive with Cron Job

Despite my best efforts, my media streaming server still dies sometimes and I am in a random place trying to ssh into the server to restart it on my cell phone after customers start calling.... I tried using google to track down a script that would do the following Every 5 min execute: sudo... (1 Reply)
Discussion started by: ajhalls
1 Replies

7. UNIX for Dummies Questions & Answers

Shell Scripts - Killing a job....

Hello all, I need to write a shell script that does the following; Allows you to kill a job,(1) listing only the jobs you own, (2) asks for which job to kill, (3) kills the job and (4) confirms kill... I am not sure if I need to first run the job command and pipe it with kill? Which options... (6 Replies)
Discussion started by: citizencro
6 Replies

8. UNIX for Advanced & Expert Users

Issue while killing the process using autosys job

Hi, I have one autosys job that will retrieve the proccess id's and will kill those processess as follows, pid=`/usr/ucb/ps -auwwxx | grep MAIN |nawk '{print $2}'` kill -9 pid but after executing this particular job, its status is showing as TE(terminated) and the kill process is... (3 Replies)
Discussion started by: Kattoor
3 Replies

9. UNIX for Advanced & Expert Users

Check the status of job

Hi, I have master job which will run based on the sub jobs status. In the master job I am giving the condition like, condition: s(sub_job) f(sub_job) This scenario will work if the sub job status is success or failed. but I want to run my master job even if the sub_job was... (1 Reply)
Discussion started by: Kattoor
1 Replies

10. UNIX for Dummies Questions & Answers

Check the URL is alive or dead with port number

Hi, I am running certain weblogic instance, in which it's hard to find which instance is stopped or running after stopping the weblogic , cause process status is for all the instance is same. A URL which shows the instance is stopped or running. But i have major challenge to check it through... (2 Replies)
Discussion started by: posix
2 Replies
pbs_resources_linux(7B) 						PBS						   pbs_resources_linux(7B)

NAME
pbs_resources_linux - pbs resources on Linux DESCRIPTION
This page summarizes the resources supported by PBS for PC workstations running Linux. These resources are specified by including them in the -l option argument on the qsub or qalter command or in the PBS job script. RESOURCES
cput Maximum amount of CPU time used by all processes in the job. Units: time. file The largest size of any single file that may be created by the job. Units: size. nice The nice value under which the job is to be run. Units: unitary. pcput Maximum amount of CPU time used by any single process in the job. Units: time. pmem Maximum amount of physical memory (workingset) used by any single process of the job. Units: size. pvmem Maximum amount of virtual memory used by any single process in the job. Units: size. vmem Maximum amount of virtual memory used by all concurrent processes in the job. Units: size. walltime Maximum amount of real time during which the job can be in the running state. Units: time. arch Specifies the administrator defined system architecture requried. This defaults to whatever the PBS_MACH string is set to in "local.mk". Units: string. host Name of host on which job should be run. This resource is provided for use by the site's scheduling policy. The allowable val- ues and effect on job placement is site dependent. Units: string. nodes Number and/or type of nodes to be reserved for exclusive use by the job. The value is one or more node_specs joined with the '+' character, "node_spec[+node_spec...]. Each node_spec is an number of nodes required of the type declared in the node_spec and a name or one or more properity or properities desired for the nodes. The number, the name, and each properity in the node_spec are separated by a colon ':'. If no number is specified, one(1) is assumed. Units: string. The name of a node is its hostname. The properities of nodes are: . ppn=# specifying the number of processors per node requested. Defaults to 1. . arbitrary string assigned by the system administrator, please check with your administrator as to the node names and properi- ties available to you. Examples: . To ask for 12 nodes of any type: -l nodes=12 . To ask for 2 "server" nodes and 14 other nodes (a total of 16): -l nodes=2:server+14 The above consist of two node_specs "2:server" and "14". . To ask for (a) 1 node that is a "server" and has a "hippi" interface, (b) 10 nodes that are not servers, and (c) 3 nodes that have a large amount of memory an have hippi: -l nodes=server:hippi+10:noserver+3:bigmem:hippi . To ask for three nodes by name: -l nodes=b2005+b1803+b1813 . To ask for 2 processors on each of four nodes: -l nodes=4:ppn=2 . To ask for 4 processors on one node: -l nodes=1:ppn=4 . To ask for 2 processors on each of two blue nodes and three processors on one red node: -l nodes=2:blue:ppn=2+red:ppn=3 host Allows a user to specify the desired execution location. This resource is provided for use by the site's scheduling policy. The allowable values and effect on job placement is site dependent. Units: string. other Allows a user to specify site specific information. This resource is provided for use by the site's scheduling policy. The allowable values and effect on job placement is site dependent. Units: string. software Allows a user to specify software required by the job. This is useful if certain software packages are only available on cer- tain systems in the site. This resource is provided for use by the site's scheduling policy. The allowable values and effect on job placement is site dependent. Units: string. EXAMPLES
qsub -l nodes=15,walltime=2:00:00 script or in a qsub script as a directive: #PBS -l nodes=15,walltime=2:00:00 qsub -l cput=1:00:00,walltime=2:00:00,file=50gb,mem=15mb script qalter -lcput=30:00,pmem=8mb 123.jobid or in a qsub script as a directive: #PBS -l cput=1:00:00,walltime=2:00:00,file=50gb,mem=15mb RESOURCE UNITS
The resource values take the following units: time specifies a maximum time period the resource can be used. Time is expressed in seconds as an integer, or in the form: [[hours:]minutes:]seconds[.milliseconds] size specifies the maximum amount in terms of bytes or words. It is expressed in the form integer[suffix] The suffix is a multiplier defined in the following table, The size of a word is the word size on the execution host. b or w bytes or words. kb or kw Kilo(1024) bytes or words. mb or mw Mega (1,048,576) bytes or words. gb or gw Giga (1,073,741,824) bytes or words. unitary The maximum amount of a resource which is expressed as a simple integer. SEE ALSO
the PBS ERS, qsub(1B), qalter(1B), pbs_submit(3B), pbs_alterjob(3B), pbs_statjob(3b) pbs_resources_aix4(7B), pbs_resources_sp2(7B), pbs_resources_sunos4(7B), pbs_resources_unicos8(7B) Local pbs_resources_linux(7B)
All times are GMT -4. The time now is 10:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy