Script to copy file small interval file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script to copy file small interval file
# 1  
Old 04-08-2010
Script to copy file small interval file

HI Guys

whenever i post a transaction , abcd.in file is stored in the temp and vanishes when the transaction is compleated . the abcd.in file stays for 1 sec in temp is der any solution to capture the abcd.in file to another directory

cp -r /tmp/abcd.in /tmp/smith.in

when i used the above command .abcd is not captured as it stayss only for fracion of sec
Thanks,
Kalyan
# 2  
Old 04-08-2010
Is it always the same file name? If so, you might make a hardlink to the file before the process runs. smith.in and abcd.in will really be the same file, but smith.in will continue to exist after abcd.in is deleted.

This will be foiled if your transaction process deletes abcd.in before it overwrites, however.
Code:
$ touch /tmp/abcd.in
$ ln /tmp/abcd.in /tmp/smith.in
$ run_process
# does /tmp/smith.in now have the contents you want?

This could also serve as a classroom example of why temp file names should be properly randomized to prevent these shenanigans. Smilie

What is this transaction process? Ideally you could just configure it to keep transaction temp files around instead of making something ugly like this. If that's impossible that's quite unfortunate.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with file copy script

Hello, I am still pretty new at writing shell scripts and may have bitten off more than I can chew. I am trying to write a script that figures out if a file exists (a known name) in directory a, then copy it to my selected destination, otherwise, look in directory b and check there. If it is in... (14 Replies)
Discussion started by: r34lj4k3
14 Replies

2. Shell Programming and Scripting

How to make multiple small file out of a single file?

Hi, I have a file that consist of around six million line, now the task is to divide this file into 12 small file so that each file would have half a million lines in it. Thanks. (3 Replies)
Discussion started by: mukulverma2408
3 Replies

3. Shell Programming and Scripting

Mailing a file at a particular time interval

Folks, I need to send a .log file to my email for every one hour from a server that too only in a particular time period. Is awk mandate here? or can we do it in shell scripting only? Please help me in sorting this out. Cheers, Arun (3 Replies)
Discussion started by: ArunJanga
3 Replies

4. Shell Programming and Scripting

Copy files with interval

Hi everybody I am not familiar with UNIX. I have a problem. There is a directory which contains Run1000.dat Run1001.dat Run1002.dat Run1003.dat . . . Run6000.dat I want to copy files from “Run2000.dat” to “Run4060.dat” with interval 20 to another directory. It means I want to copy... (2 Replies)
Discussion started by: bineshb
2 Replies

5. Shell Programming and Scripting

Match File and Copy File Script (Homework, Closed)

Can you please help on this? I am looking for the shell script which does following:- step 1: It should open the file /u/manish/input/FileIndex.dat and read line by line step 2: Once first line is read (for ex: File1), we have to find a file, that contains this matching... (4 Replies)
Discussion started by: teteguru1
4 Replies

6. UNIX for Dummies Questions & Answers

Shell script to search for text in a file and copy file

Compete noob question.... I need a script to search through a directory and find files containing text string abcde1234 for example and then copy that file with that text string to another directory help please :eek: (9 Replies)
Discussion started by: imeadows
9 Replies

7. Shell Programming and Scripting

copy file from script file to remote computer

hi, i want copy one or group of file from a computer to others, but i have some problem that do not allow me to do this. i do this by scp command like this : scp <file name> root@cpName:destinationAddress but the problem is that it do not it automatically. it means when it is connecting to... (4 Replies)
Discussion started by: MShirzadi
4 Replies

8. Shell Programming and Scripting

script to splite large file to number of small files

Dear All, Could you please help me to split a file contain around 240,000,000 line to 4 files all equally likely , note that we need to maintain that the end of each file should started by start flage (MSISDN) and ended by end flag (End), also the number of the line between the... (10 Replies)
Discussion started by: ahmed.gad
10 Replies

9. Shell Programming and Scripting

Script to capture new lines in a file and copy it to new file

Hi All, I have a file that gives me new line/output every 5 minutes. I need to create a script that capture new line/output besides "IN CRON_STATUS", in this case the new output is "begin ------ cron_status.sh - -----------". I want this script to capture the line starting from "begin ------... (0 Replies)
Discussion started by: fara_aris
0 Replies

10. Shell Programming and Scripting

Help:Copy file from one to other using script

Hi Frineds, Through my DTS process I am generating one file at one directory like, /sqlsrvr_demo/dts/put/transaction_fact.csv now I want to copy this files(only when the files size is greater than 0 kb) to some other directory like /sqlsrvr_demo/dts/get/transaction_fact.csv Can... (2 Replies)
Discussion started by: sunnysunny
2 Replies
Login or Register to Ask a Question