Sponsored Content
Full Discussion: Help with Copy Move Script
Top Forums Shell Programming and Scripting Help with Copy Move Script Post 50935 by alfpathros on Wednesday 5th of May 2004 03:44:43 PM
Old 05-05-2004
Question Help with Copy Move Script

Hello Gurus!

Please help!

I would like to get some help with the following:

I'm working right now on a Data Warehouse project and I need to automate a manual procedure I am using to process the data files coming into the database, any information/ideas and or which script language to go with, would be greatly appreciated.

Procedure:
I have 2 stages directory architecture.
“Receiving_NewFiles” directory and “Files_Processed” directory:

Check the receiving directory for new files coming from an external system (ASCII format or non relational DBs format) and import/transport them into the database once this is done, rename the processed files and transfer them into an archiving directory called Files_Processed. I would also like to have this procedure run automatically every 5 minutes.

I would like to some how generate an error_log/alert_log file to monitor whether the process run successfully or not, additionally, I would also like it to record the name of any file that can't be processed or transferred.

Environment:
OS: AIX 5.2
Oracle 9i R2

Thanks a lot in advance for your help, day

So far this is what I had come with so far.

#!/usr/bin/bash
DIR='/oracle/utl_file_dir/NewFiles'
ORACLE_HOME=/
PATH=
ORACLE_SID=; export ORACLE_SID

#
# CHECK If Script is already running ?????
#
cnt=`ps -ef|grep $0|grep -v grep|grep -v $$|wc -l`
if [ ${cnt} -eq 1 ]
then
echo "Script not running " ---- continue processing
else
echo "Script running " ---- exit processing
exit
fi

#
# CHECK DATABASE AVAILABILITY
#

cnt=`sqlplus <<%|grep -i error|wc -l
username/password
exit
%`

if [ ${cnt} -eq 0 ]
then
echo "DB Available" ---- Further processing
else
echo "DB NOT AVAILABLE ....We are Down"; --- Stop
exit
fi


cd /oracle/utl_file_dir/NewFiles

for file in `ls X*`
do
echo ${file}
if [ -s ${file} ]
then
echo ${file}
cp ${file} ../../ProcessedFiles/.
echo `date` ${file} to become ${file:1} >> rename.log
mv ${file} ${file:1}
else
echo 'file not found...'
fi
done
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to copy/move folder on XP to Solaris?

I have created a folder on C:\images\Raffles.jpg on my PC, and I like to copy or move to Solaris server. How can I do that? Please advise. Thanks in advance. (2 Replies)
Discussion started by: simt
2 Replies

2. Shell Programming and Scripting

ncftp copy/move pb

Hi, i have made this script for copy file in folder FTP in my local machine, when copy is finish i move files copied in backups_001 directory on same ftp 1°) the problem is if this script works with date if date is similar i taken, but if one day in ftp they put new file is no getting ... (0 Replies)
Discussion started by: livetele
0 Replies

3. Shell Programming and Scripting

Bash Copy-Move file problem

Hello, I made a script to copy files from one directory to another and move file after the copy is done. When files are present in the source directory there is no problem but when no file are present I'm getting an error. Please help !! --------------------- #!/bin/bash ... (2 Replies)
Discussion started by: lsimoneau
2 Replies

4. UNIX for Dummies Questions & Answers

How to copy/move to a file with a special character as the 1st char in the filename?

I am trying to create files with special characters in its filenames for testing purposes. This is on a Linux RHEL4 but this should also be applicable on a Unix shell. I am able to create files with special characters in the filenames...e.g. cp -pv foo.gif \*special.gif cp -pv foo.gif \... (6 Replies)
Discussion started by: sqa777
6 Replies

5. UNIX for Dummies Questions & Answers

help pls! need to move and copy pattern...

Help please... Need to convert below: Subcase ID : 10001 210000 0 1.22049E+01 220000 0 6.29560E+00 Subcase ID : 20703 210000 0 2.76398E+00 220000 0 2.43183E+00 230000 0 -1.87728E+01 Subcase ID : 13703 210000 0 ... (2 Replies)
Discussion started by: lakanino
2 Replies

6. UNIX for Dummies Questions & Answers

Unable to copy or move file

I am trying to move a file that is in the root directory. I suspect it is an old file created by someone when the system was installed. I am testing accessing the file by doing a copy but the command does not find the file. I am operating as root. We are HP-UX B.11.23 I do long listing and... (3 Replies)
Discussion started by: phcorn
3 Replies

7. Shell Programming and Scripting

Copy/move file which are not currently in use.

Hello experts, I'm doing a shell script that able to copy or move files. My situation is i have a drive ( lets say its S drive) where its receive all the files from mainframe i need to copy all the file from S drive to T drive. but only those files that are finished copied from mainframe... (5 Replies)
Discussion started by: CelvinSaran
5 Replies

8. Shell Programming and Scripting

Copy or Move problem

Hi All, I have a simple shell script to move .txt file(s) from a source directory one after another to the destination. The source directory is shared to windows using samba. The source files are arriving continuously and approx size is 10-15 KB. Some time the file size reached upto 100 KB and... (9 Replies)
Discussion started by: sraj142
9 Replies

9. Solaris

Can't erase/move/copy file!

Hey everyone!. I have a problem with a file that doesn't allow any operation on it. I can't rm,mv,cp nor any other operation to it, I get the following errors: bash-2.05# mv ora_2527.aud /bkp mv: cannot access ora_2527.aud bash-2.05# cp ora_2527.aud /bkp cp: cannot access ora_2527.aud... (4 Replies)
Discussion started by: dragonov7
4 Replies

10. Red Hat

Separate the apache user file and move or copy some were

Hi all, I'm Using Centos 6.4 /opt/my_aplication/entry/data/0/ There are Thousands of files in this Directory, Only i need to copy or move the apache User's file from this to /tmp/backup , I have listed apache user's file using find . -user apache -type f , its gave me the only apache... (2 Replies)
Discussion started by: babinlonston
2 Replies
SYSSTAT(5)							Linux User's Manual							SYSSTAT(5)

NAME
sysstat - sysstat configuration file. DESCRIPTION
This file is read by sa1(8) and sa2(8) shell scripts from the sysstat's set of tools. It consists of a sequence of shell variable assign- ments used to configure sysstat logging. The variables and their meanings are: HISTORY The number of days during which a daily data file or a report should be kept. Data files or reports older than this number of days will be removed by the sa2(8) shell script. COMPRESSAFTER Number of days after which daily data files are to be compressed, either by gzip or bzip2. SADC_OPTIONS Options that should be passed to sadc(8). With these options (see sadc(8) manual page), you can select some additional data which are going to be saved in daily data files. These options are used only when a new data file is created. They will be ignored with an already existing one. FILES
/etc/sysstat/sysstat AUTHOR
Sebastien Godard (sysstat <at> orange.fr) SEE ALSO
sadc(8), sa1(8), sa2(8) http://pagesperso-orange.fr/sebastien.godard/ Linux SEPTEMBER 2010 SYSSTAT(5)
All times are GMT -4. The time now is 01:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy