Sponsored Content
Top Forums Shell Programming and Scripting write a shell script to execute a command Post 302329581 by learn_linux on Monday 29th of June 2009 12:46:50 AM
Old 06-29-2009
Hi,
Thanks for the reply. I do not want to print "Done".
I am running a job on a cluster. The output of which remains stored there until I say "getoutput" on my terminal which then brings the output on my hard disk. What I do is I first check the status of the job stored in a file "out" (in my case) and then if the job is done I say "getoutput".
I want to write a shell script which can execute a command "getoutput" (this is a command which is specific to a cluster I am working on) after checking if the job status is "Done".

I have written a line which is trying to do the same:

========================CODE====================
flag[1]=0
flag[2]=0
cat out | gawk 'BEGIN{i=1;}{if($2=="Done") { $flag[i]=1; i=i+1;}'

if($flag[1]==1 && $flag[2]==1); then
getoutput
fi

======================================================

But the problem here is that after the gawk is over, the values of flags are still 0 even if $2=="Done" i.e. gawk is not changing the value of flags globally (only locally) which should get changed if $2=="Done"

Thanks,
learn_linux
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Urgent!! How to write a shell program to execute command to access internet?

hi, I am new ot unix. So, can i write a shell(c shell or korn shell) program to access internet? I mean if I run the program, it can access specified url and then copy the html to a file? Can anyone help me? And how can make the program runs every 1 hr? new comer (2 Replies)
Discussion started by: firebirdonfire
2 Replies

2. UNIX for Dummies Questions & Answers

Plz Help : How to use write command to execute command on some other terminal

Hi Group , I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages. - i m writing >write user-id ! ls o ctrl-d inspite of executing the command ls,other terminal shows ! ls. Thnx in advance. (2 Replies)
Discussion started by: Aashish
2 Replies

3. Shell Programming and Scripting

shell script to execute user command

I don't know why the following shell script doesn't work. Could you please help me out? #!/usr/bin/ksh test="cal > /tmp/tmp.txt 2>&1" $test I know it will work for the following format: #!/usr/bin/ksh cal > /tmp/tmp.txt 2>&1 However, I need to get the command from the user in... (1 Reply)
Discussion started by: redtiger
1 Replies

4. Shell Programming and Scripting

Need to Write Shell Script based off of this shell command

I'm trying to read a bunch of log files and output the lines that contain particular strings. To accomplish this, I've been running the following from the command line: find . -name "*" | xargs grep " " | grep " " > output.txt Two grep statements are needed in case I'm looking for a... (3 Replies)
Discussion started by: Rally_Point
3 Replies

5. Shell Programming and Scripting

Execute a shell script after a particular command is run

Hi, I need to run a script whenever the Cron file is modified. The requirement is whenever a user modifies the cron file, the script should run automatically. Can you please provide your inputs ? (5 Replies)
Discussion started by: harneet2004us
5 Replies

6. UNIX for Dummies Questions & Answers

ssh command to execute shell script in another server

ssh -q <hostname> /opt/tcs/satish/tst.ksh ssh -q <anotherserver> /opt/tcs/satish/tst.ksh tst.ksh has "nohup <command> & " when i execute below script , its throwing error as nohup can not be found ssh -q <anotherserver> /opt/tcs/satish/tst.ksh > log & can someone let me... (5 Replies)
Discussion started by: only4satish
5 Replies

7. UNIX for Dummies Questions & Answers

How to execute command after telneting in shell script?

Hi , I have to write a shell script to telnet to specific host and execute the admin command there. Please help me to do that. Eg : telnet hostname portno admin command exit (3 Replies)
Discussion started by: arukuku
3 Replies

8. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

9. Shell Programming and Scripting

Need to execute Oracle relocation command in shell script

Hello, I need to execute below command in shell script srvctl relocate service -d $database -s $service -i $avail -t $pref -f and also need to get the errors ,if any,in another file. What's the right way to execute such commands in shell script? Best regards, Vishal (1 Reply)
Discussion started by: Vishal_dba
1 Replies

10. Shell Programming and Scripting

How to execute application command in shell script?

friends, i have application commands to execute in shell script it is something like this. i will login with user data it takes me to $ prompt. Example given below login: data ps : xxxx $ MNSinput --this takes me to greater than prompt > > ops --this is command i enter this output... (7 Replies)
Discussion started by: udaykrishna
7 Replies
CONDOR_QSUB(1)							   User Commands						    CONDOR_QSUB(1)

NAME
condor_qsub - minimalistic qsub emulation for Condor SYNOPSIS
condor_qsub [OPTIONS] [<command> [<command_args>]] DESCRIPTION
Minimalistic emulation of SGE's qsub for Condor. The primary purpose of this emulation is to allow SGE-style submission of dependent jobs without the need to specify the full dependency graph at submission time. This implementation is neither as efficient as Condor's DAGMan, nor as functional as SGE's qsub/qalter. It merely serves as a minimal adaptor to be able to use software original written to interact with SGE in a Condor pool. In general condor_qsub behaves just like qsub. However, only a fraction of the original functionality is available. The following list of options only describes the differences in the behavior of SGE's qsub and this emulation. Qsub options not listed here are not supported. OPTIONS
-b <y|n> If 'y', command and arguments given on the command line are wrapped into a shell script which is then submitted to Condor. --condor-keep-files This is a non-SGE option. If given, it will prevent condor_qsub from deleting temporary files (generated submit files, sentinel jobs). This is mostly useful for debugging. -cwd If given, this option will cause the 'initialdir' value in the Condor submit file to be set to the current directory. -e <filename|path> Name of the file to contain the STDERR output of the job. By default this will be job_name.ejob_id[.task_id]. If an existing direc- tory is specified, the file will be placed inside this directory using the default schema for the filename. -h,--help Print usage summary and option list. -hold_jid <jid> If given, the job will be submitted in 'hold' state. Along with the actual job a 'sentinel' job will be submitted to Condor's local universe. This sentinel watches the specified job and releases the submitted job whenever the job has completed. The sentinel observes SGE's behavior to detect job exiting with code 100 and not start depedent job in this case. If a cluster id of an array job is given the dependent job will only be released after all individual jobs of a cluster have completed. -l <ressource spec> This option is currently ignored. -m <a|e|n><...> SGE's notification labels will be translated (approximately) into Condor's notifications states (Never, Error, Complete). -M <email> Added as 'notify_user' to the submit file. -N <jobname> Determines the default name of logfile (stdout, stderr). -o <filename|path> See -e option, but for a job's stdout. -p <int> Added a 'priority' to the submit file. -r <y|n> This option is currently ignored. -S <shell> Path to a shell binary for script execution. -shell <y|n> This option is currently ignored. -t <start>[-<stop>[:<step>]] Task ID specification for array job submissions. -q <queue name> This option is permanently ignored, as Condor doesn't have multiple queues. -V If given, 'getenv = True' is added to the submit file. --version Print version information and exit. This script is released under the Apache V2.0 License. It was written by Michael Hanke <michael.hanke@gmail.com>. condor_qsub 0.1 September 2012 CONDOR_QSUB(1)
All times are GMT -4. The time now is 06:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy