UNIX automation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX automation
# 1  
Old 11-30-2010
UNIX automation

Hello People,
I have an outstanding issue with me
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

My work involves few manual process like
transfer
1.DE 1.TXT and
5.Fe.ok to
/usr/dob location and run one script(for example - my_script.ksh) which executes both above 2 files. As soon as that is finish, i need to transfer
2.DE 2.TXT AND
5.Fe.ok to /usr/dob location and run one script again.
This process continues until the last file called
4.DE 4.TXT and 5.Fe.ok are not completed.

Here
5.Fe.ok is the common file which need to be transferred all the time.

I want a automated script which will do the above process.

Automated script process -

Transfer
1.DE 1.TXT and
5.Fe.ok to
/usr/dob location from /usr/abc and run my_script.ksh.
If success transfer next set
2.DE 2.TXT AND
5.Fe.ok
and so on.................

If fails throw an ERROR...


Please help...

---------- Post updated at 04:39 PM ---------- Previous update was at 04:33 PM ----------

sorry missed one more thing..
Also if first set fails it should not transfer the second set, it should throw an error and come out of the loop.Same goes on with 2nd 3rd and 4th..
# 2  
Old 11-30-2010
Please state:
What Operating System you have.
What Shell you are using.
What is in the scripts.
What you type to execute those scripts, making it clear which computer you are typing on at the time if there is more than on computer involved.
Any error messages. Please report error messages exactly not just as "error".
# 3  
Old 11-30-2010
Its Linux OS...
Its pure Unix scripting i was talking about...
# 4  
Old 11-30-2010
When you "transfer" what do you actually type?
# 5  
Old 11-30-2010
from /usr/abc prompt i type
Code:
cp 1.DE 1.TXT 5.Fe.ok /usr/dob

# 6  
Old 11-30-2010
Perhaps this is the sort of script you are looking for. Script is untested.
Note that "break" stops the whole process. If you want to try the next pair of files, replace "break" with "continue".

I have assumed that you have a Bourne-type script like "bash".

Code:
for filename in "1.DE 1.TXT" "2.DE 2.TXT" "3.DE 3.TXT" "4.DE 4.TXT"
do
        if [ ! -f "${filename}" ]
        then
                echo "File missing: ${filename}"
                break
        fi
        filename2="5.Fe.ok"
        if [ ! -f "${filename2}" ]
        then
                echo "File missing: ${filename2}"
                break
        fi
        #
        cp "${filename}" /usr/dob
        cp "${filename2}" /usr/dob
        /pathname/my_script.ksh; ERROR=$?
        if [ ! ${ERROR} -eq 0 ]
        then
                echo "Error from /pathname/my_script.ksh"
                break
        fi
done

# 7  
Old 12-01-2010
The above script doesnt work.
What i mean to say is if i execute the above code without
Code:
/pathname/my_script.ksh; ERROR=$?
        if [ ! ${ERROR} -eq 0 ]
        then
                echo "Error from /pathname/my_script.ksh"
                break
        fi

Your script simply transfer all the files 1.DE 1.txt" "2.DE 2.txt" "3.DE 3.txt" "4.DE 4.txt and 1.DE 1.txt" "2.DE 2.txt" "3.DE 3.txt" "4.DE 4.txt to the location 1.DE 1.txt" "2.DE 2.txt" "3.DE 3.txt" "4.DE 4.txt.
I dont want this to happen..

Last edited by Scott; 12-01-2010 at 06:09 AM.. Reason: Removed double post.
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