Sponsored Content
Full Discussion: UNIX automation
Top Forums Shell Programming and Scripting UNIX automation Post 302492946 by j_panky on Wednesday 2nd of February 2011 01:57:18 AM
Old 02-02-2011
Here is the whole script again.
Code:
chk_file(){
RC=0
[[ ! -f "$1" ]] && echo "File missing: $1" && RC=1
return $RC
}
i=1
while [ $i -lt 100 ]
do
# if [ $(ls $i.* | wc -l 2>/dev/null) -gt 1 ]
if [ $((ls $i.* | wc -l) 2>/dev/null) -gt 1 ]
 
then
echo "Error : more than 1 File found starting with increment $i, script aborted"
exit 1
fi
# filename=$(ls $i.*)
 
filename=$((ls $i.*) 2>/dev/null)
echo "$filename is the filename"
# filename2=$(ls *Fe.ok | tail -1)
filename2=$((ls *Fe.ok | tail -1) 2>/dev/null)
echo "$filename2 is the filename"
# chk_file "${filename}" || break
# chk_file "${filename2}" || break
chk_file "${filename}"
#chk_file "${filename2}"
# cp "${filename}" "${filename2}" /usr/dob
ERROR1=$?
 
if [ ! ${ERROR1} -eq 0 ]
then
echo "Error , FILES NOT AVAILABLE TO COPY"
# break
else
cp "${filename}" "${filename2}" /usr/dob
 
echo "PROCESSING $filename and $filename2"
/usr/dob/my_script.ksh
echo "$filename completed......"
fi
ERROR=$?
 
if [ ! ${ERROR} -eq 0 ]
then
echo "Error from /usr/dob/my_script.ksh"
break
fi
let i+=1
done

---------- Post updated at 12:27 PM ---------- Previous update was at 12:17 PM ----------

Now, these scripts are at location /usr/abc and the listing or as per ls -la are below
Code:
1.L_D1.txt
3.L_ND.txt
5.L_D4.txt
14.L_ND4.txt
Fe.ok
EXECUTE123.ksh (This is our above script given by @ctsgnb)


Last edited by j_panky; 02-02-2011 at 03:03 AM..
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
acctmerg(1M)						  System Administration Commands					      acctmerg(1M)

NAME
acctmerg - merge or add total accounting files SYNOPSIS
/usr/lib/acct/acctmerg [-a] [-i] [-p] [-t] [-u] [-v] [filename] ... DESCRIPTION
acctmerg reads its standard input and up to nine additional files, all in the tacct format (see acct.h(3HEAD)) or an ASCII version thereof. It merges these inputs by adding records whose keys (normally user ID and name) are identical, and expects the inputs to be sorted on those keys. OPTIONS
-a Produce output in ASCII version of tacct. -i Produce input in ASCII version of tacct. -p Print input with no processing. -t Produce a single record that totals all input. -u Summarize by user ID, rather than by user ID and name. -v Produce output in verbose ASCII format, with more precise notation for floating-point numbers. EXAMPLES
Example 1: Using the acctmerg command. The following sequence is useful for making "repairs" to any file kept in this format: example% acctmerg -v <filename1>filename2 Edit filename2 as you want: example% acctmerg -i <filename2>filename1 ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWaccu | +-----------------------------+-----------------------------+ SEE ALSO
acctcom(1), acct(1M), acctcms(1M), acctcon(1M), acctprc(1M), acctsh(1M), fwtmp(1M), runacct(1M), acct(2), acct.h(3HEAD), utmpx(4), attributes(5) System Administration Guide: Basic Administration SunOS 5.10 22 Feb 1999 acctmerg(1M)
All times are GMT -4. The time now is 03:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy