UNIX automation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX automation
# 8  
Old 12-01-2010
Are you intending to automate the run of "my_script.ksh" or run it manually? The script I posted assumes that you will run it automatically.
I guess that "my_script.ksh" will need to take filenames as parameters.

It would help id we could see "my_script.ksh".

Last edited by methyl; 12-01-2010 at 06:19 AM..
# 9  
Old 12-01-2010
Its just that i need to transfer the set, then run my_script.ksh.
My script will only check it the 2 files are available or not...if yes it will finish and exit..
Then again i cp second set and again run my_script.ksh..

Yes ofcourse my_script is taking 2 filenames as it parameter...

I hope this will help you...
# 10  
Old 12-01-2010
In my posted script the call of "my_script.ksh" is inside the do-done loop and will be executed each time a each pair of files are copied.
I thinks that all you need to do is to adjust the call to "my_script.ksh", though it does depend on what is in the script and whether it contains relative or absolute pathnames.

---------- Post updated at 12:40 ---------- Previous update was at 11:15 ----------


I might be understanding the problem.

Quote:
I have 5 files at location /usr/abc called

Code:
1.DE 1.TXT
2.DE 2.TXT
3.DE 3.TXT
4.DE 4.TXT
5.Fe.ok
Are there actually 9 files ? i.e. Are say "1.DE" and "1.TXT" separate file names?

Last edited by methyl; 12-01-2010 at 10:56 AM.. Reason: 9 files
# 11  
Old 12-01-2010
@ Methyl

could be shorten a little like

Code:
for i in 1 2 3 4
do
    if [ ! -f "$i".DE || ! -f "$i".TXT} ]
    then
        echo "Err : file missing"
        break
    fi
    cp "$i".{DE,TXT} 5.Fe.ok /usr/dob
    if ( ! /pathname/my_script.ksh >/dev/null )
    then
        echo "Err : my_script.ksh execution error"
        break
    fi
done

# 12  
Old 12-01-2010
I think that crsgnb has cracked it. We must assume that there are 9 files (not 5 files) and that the O/P has a modern "bash" Shell.
(the ".ksh" is omninous).

Last edited by methyl; 12-01-2010 at 11:30 AM..
# 13  
Old 12-02-2010
Thanks Methyl...The for loop script is working pretty fine..
Just another question on the same front...
It will be ok is i have 3 or 4 file, so as per your script we can put 3 file names in the for loop but its not fesible if there are more then 50 or rather 100 files. It will be highly impossible to put all the file names in the for loop.. Any suggestion in the regards or may be the script if u have.......

---------- Post updated at 04:40 PM ---------- Previous update was at 04:15 PM ----------

Sorry i didnt get you..Waht do u mean by "I think that crsgnb has cracked it."
# 14  
Old 12-02-2010
instead of
Code:
for i in 1 2 3 4
do
...
done

go for a while loop

Code:
i=0
while [ $i -lt 100 ]
do
...
let i++
done

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Automation using bots in Linux/UNIX ?

Hi folks, has any one attempted using bots for performing tasks in unix?please share if you faced any challenges thanks (1 Reply)
Discussion started by: tommy812
1 Replies

2. Post Here to Contact Site Administrators and Moderators

UNIX automation

I am using netteza server and i have a list of table names. I need to fetch all the data from these tables and need to create seperate zip files and store in a folder in the server. How can we automate this process. (1 Reply)
Discussion started by: nikhilthms97
1 Replies

3. Shell Programming and Scripting

Unix fdisk -l Automation

Hello Folks - Need help really ASAP. Iam trying to run this Shell command to get all the lists of partitions and disks from across all the servers. #!/bin/ksh _servers="" _out="/tmp/output.$$" _ssh=/usr/bin/ssh >$_out for s in $_servers do $_ssh $s fdisk -l >> $_out done ... (8 Replies)
Discussion started by: bkilaru
8 Replies

4. Homework & Coursework Questions

Mail Automation in UNIX

Hi Sir, I need unix code which will read data present in .xls file and should send an automated mails .when i place the .XLS file in a specific folder and run ***.sh from unix box Attached Excel file contains Subject , To , CC , Body (Paragraph 1) , Body (Paragraph 2) , Signature When i... (2 Replies)
Discussion started by: chaitanyaS
2 Replies

5. Shell Programming and Scripting

creating an automation process in unix .

hi i need shell script in ksh for the automation process in informtica. The automation process is like this . i have a folder in unix . when this folder gets updated (like if a file or files is/are added to the folder) an event in informatica is triggered and after the process is done in... (2 Replies)
Discussion started by: kumar8887
2 Replies

6. Shell Programming and Scripting

Simple Unix Automation

Hi, i'm a newbie with unix and shell scripting. I'm just trying to do a script to simply automate a unix task. This are the steps on what i want to just run on a simple shell script 1. go to a specific path (cd /folder1/folder2/) 2. edit and input a number on a file (file_id) then save exit... (6 Replies)
Discussion started by: soultransit
6 Replies

7. Shell Programming and Scripting

Test automation tool for UNIX ??

I am searching for a automation testing tool which I can use for most of the UNIX platforms (AIX, Linux, HP UX, Solaris). The installation process of the application in all platforms is almost same. Are you aware of any automation tool (like WinRunner for Windows) to solve my problem? (5 Replies)
Discussion started by: unmanju
5 Replies

8. UNIX for Advanced & Expert Users

automation of Informatica jobs using Unix

1.How will you do automation of Informatica jobs using Unix ? 2. How u run workflow from Unix? :) (2 Replies)
Discussion started by: kamesh83
2 Replies

9. Cybersecurity

FTP Automation Windows <> Unix <> Remote

Hi All, I am a newbie to unix and scripting. I need to do the following job: 1. Create a batch file in windows that will call a script in a remote unix box. 2. The script now ftp files from the Remote windows machine and get them back to the local windows. Actually, I have written the script... (3 Replies)
Discussion started by: Ankur
3 Replies
Login or Register to Ask a Question