Code for execution command by command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Code for execution command by command
# 1  
Old 09-22-2010
Code for execution command by command

a)
Code:
 cd /root/user/dir/sd/disk
./runInstaller -silent -responseFile

b)
Code:
 cd /root1/user1
cp /root/user/dir/sd/disk/ram.txt

now a) executes and starts running but b) interupts a) and is executed while a) is running on the other hand


so I want b) to start only after successfull completion of a)

Last edited by vbe; 09-22-2010 at 10:42 AM.. Reason: code tags...
# 2  
Old 09-22-2010
Code:
/root/user/dir/sd/disk/runInstaller -silent -responseFile && cp /root1/user1/root/user/dir/sd/disk/ram.txt

...and you are missing the destination in "cp"
# 3  
Old 09-22-2010
Quote:
...and you are missing the destination in "cp"
or is it the destination and you are missing the source...
# 4  
Old 09-22-2010
I need b) to run only after a) is done successfully. I need to do it by if loop.
# 5  
Old 09-22-2010
That we agree and as verdepollo suggests "&&" is what you need, but this said your cp command line has something missing: either source , either destination...


All the best
# 6  
Old 09-22-2010
ya I can fill out the destination ...and can i use this


cd /root/user/dir/sd/disk
./runInstaller -silent -responseFile

if [$? eq "0"]
then
cp /root1/user1/root/user/dir/sd/disk/ram.txt

fi

---------- Post updated at 10:55 AM ---------- Previous update was at 10:52 AM ----------

and also my putty terminal exits due to inactivity as it takes around 30 minutes to completely install the runinstaller..It says " shell timeout in 60 seconds due to inactivity"
Is there any way to avoid that for ever
# 7  
Old 09-22-2010
There is a timeout parameter in ssh configuration, and there is one for your shell: TMOUT
in ksh you would
Code:
export TMOUT=0  #or unset TMOUT

And for ssh, unfortunately I am being called for a serious issue, and you would have to wait for someone else to take over

Regards

---------- Post updated at 19:45 ---------- Previous update was at 16:58 ----------

Didnt notice this before :
https://www.unix.com/shell-programmin...ter-other.html
So continue on above link
No bumping admitted!
Thread closed

Last edited by vbe; 09-22-2010 at 02:42 PM.. Reason: typos
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Execution of command at command prompt

Hello Experts, I am still learning linux and have come across a question, hope to get some answer. I have two servers, and both have the same version of svn client installed and both have the same user_id. my SVN client version: svn, version 1.6.11 (r934486) compiled Mar 2 2011,... (4 Replies)
Discussion started by: babyPen1985
4 Replies

2. UNIX for Advanced & Expert Users

Parallel Execution of Command

Hi All, We have a table that has to store around 80-100 million records. The table is partitioned by a column called Market Code. There are 30 partitions each corresponding to one MRKT_CD. The source of this table is a join between 3-4 other tables. We are loading this table through SQLPLUS... (2 Replies)
Discussion started by: jerome_rajan
2 Replies

3. Shell Programming and Scripting

Command execution from other directory

Hi, I need to execute some commands in a directory. script called test.sh from /usr/bin/ and the commands which are there in the script needs to be executed from /etc/ and come back to another directory /lib/ and execute some commands which are there in the script. Hope you understand... (1 Reply)
Discussion started by: munna_dude
1 Replies

4. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

5. Shell Programming and Scripting

Want to terminate command execution when string found in the command output

Hi Experts, I am very much new to linux scripting, I am currently working on reducing my manual work and hence writing a script to automate few task. I am running below command to snmpwalk the router.. snmpwalk -v 3 -u WANDL_SU -a MD5 -A vfipmpls -x DES -X VfIpMpLs -l authPriv... (19 Replies)
Discussion started by: Hanumant.madane
19 Replies

6. Shell Programming and Scripting

both sides execution of command

Hi, i am struggling with a chunk of code. for ((i=1; i<=3; i++));do one-$i ="/tmp/one.$RANDOM" done How to execute the above code. In both sides(LHS and RHS), i am executing commands. it is not allowing to execute. can you please give the idea. It should be very... (8 Replies)
Discussion started by: munna_dude
8 Replies

7. Shell Programming and Scripting

Remote command execution

We have multiple Unix servers and a particular command can only be executed in one of the box from a specific path. I have password-less ssh set up for all the boxes. I am unsure the command to use to execute that particular command from any other box. To be specific say program named _my_exe_ can... (4 Replies)
Discussion started by: uunniixx
4 Replies

8. Shell Programming and Scripting

command execution time

Hi all, I want to display a progressbar depending upon the completion status of a command. I am coding from scratch as I dont want to use in place code. so Is there anyway of getting the progress of a command in percentage or in any other units while its running , is it possible using the top... (5 Replies)
Discussion started by: hashin_p
5 Replies

9. UNIX for Advanced & Expert Users

command execution ??

hi i have small shell script as follows cd /utilities/promoter/tmp grep SENDREPLY $1 | grep 'zzzzz@zzz.com' | awk -F" -f1 > /tmp/$LOGNAME/$1.request cd /tmp/$LOGNAME grep -e "\.sql" -e "\.md" $1.request > upd_$1.txt grep -v -e "\.sql" -e "\.md" $1.request > copy_$1.txt ... (1 Reply)
Discussion started by: zedex
1 Replies

10. Shell Programming and Scripting

Status code of last command execution

Hello people, I am using KSH and inside my script I do a cksum and check the status code to see whether the command sucessfully. Here even though the cksum fails due to file not existing the status returned is still 0 because the awk command worked fine. How do I capture just the status of the... (1 Reply)
Discussion started by: tipsy
1 Replies
Login or Register to Ask a Question