Sponsored Content
Top Forums Shell Programming and Scripting Error check for copying growing directories Post 302815203 by RudiC on Friday 31st of May 2013 07:05:58 AM
Old 05-31-2013
Don't cp, use mv instead. mv is an atomic command, deleting the source only if copy succeeded.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to check a file in UNIX is closed or growing?

We have a third party tool in UNIX to kick off a 'file copy' job based on a file existance. If a specific file exists in an UNIX directory, another process should start copy the file into another system for further processing. The issue is, the copy job is starting as soon as the file exists in... (6 Replies)
Discussion started by: kslakshm
6 Replies

2. UNIX for Dummies Questions & Answers

Copying multiple directories at the same time using Unix

Another Unix question. How would I copy multiple directories at the same time? Right now I do: cp -r -f /directory1/ ../backup/directory1/ I do that for each directory one at a time. But there are multiple directories I'd like to copy. So instead of sitting there and doing one at a time, is... (9 Replies)
Discussion started by: JPigford
9 Replies

3. UNIX for Dummies Questions & Answers

copying to multiple directories using wildcard

Can we copy a file to multiple directories using a single command line , i tried with * didnt work for me cp /tmp/a.kool /tmp/folder/*/keys/ I am tryn to copy a.kool file to all keys folder in /tmp folder. is something i am missing ? (4 Replies)
Discussion started by: logic0
4 Replies

4. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies

5. UNIX for Dummies Questions & Answers

Using find -d and copying to the found directories

Hi again All :) After posting my first thread just a few eeks ago and having such a great response (Thank You once again :) ), I thought I'd perhaps ask the experts again. In short I'm trying to achieve a "find" and "copy" where the find needs to find directories: find -d -name outbox and... (6 Replies)
Discussion started by: Dean Rotherham
6 Replies

6. Shell Programming and Scripting

Copying all directories while ignoring certain filetypes

I want to write a script that copys over a complete folder including the dirs to another location. However in the process I want to ignore several filetypse that SHOULD NOT get copied over. I know Global Ignore is capable of make the copy command ignore one file type, however I don't know how... (8 Replies)
Discussion started by: pasc
8 Replies

7. Shell Programming and Scripting

Copying data from files to directories

I have the following that I'd like to do: 1. I have split a file into separate files that I placed into the /tmp directory. These files are named F1 F2 F3 F4. 2. In addition, I have several directories which are alphabetized as dira dirb dirc dird. 3. I'd like to be able to copy F1 F2 F3 F4... (2 Replies)
Discussion started by: newbie2010
2 Replies

8. UNIX for Dummies Questions & Answers

How to check if my log file is growing properly?

Hi All, I want to check if one my log file is updating properly, how can I achieve it. The approach I am trying is to get the file size at two different interval and than comparing it eg : $ ls -ltr | tail -1 | awk '{print $5}' 20480 (7 Replies)
Discussion started by: mukulverma2408
7 Replies

9. UNIX for Dummies Questions & Answers

Copying Directories from one server to another

Hi, I have a requirement where I have to connect to another server and copy directories from one server to another Directories on the Source server look like below (YYYY-MM-DD- 1 to 23) drwxr-xr-x 2 test_user dmfmart 422 Sep 1 23:45 2014-09-01-18 drwxr-xr-x 2 test_user dmfmart ... (3 Replies)
Discussion started by: arunkesi
3 Replies

10. Shell Programming and Scripting

Copying files to directories based on first 6 character

guys, i did create a script but its too long, though it function the same. # cat nightlyscan.sh #!/usr/ksh deyt=`date +"%Y-%m-%d"` for i in `ls -lrt|grep $deyt|awk '{print $9}'` do cp -f $i /S1/Sophos/logger/ done # but i did not paste it all. this is the desired. (9 Replies)
Discussion started by: kenshinhimura
9 Replies
ATOMIC_OPS(3)						   BSD Library Functions Manual 					     ATOMIC_OPS(3)

NAME
atomic_ops -- atomic memory operations SYNOPSIS
#include <sys/atomic.h> DESCRIPTION
The atomic_ops family of functions provide atomic memory operations. There are 7 classes of atomic memory operations available: atomic_add(3) These functions perform atomic addition. atomic_and(3) These functions perform atomic logical ``and''. atomic_cas(3) These functions perform atomic compare-and-swap. atomic_dec(3) These functions perform atomic decrement. atomic_inc(3) These functions perform atomic increment. atomic_or(3) These functions perform atomic logical ``or''. atomic_swap(3) These functions perform atomic swap. Synchronization Mechanisms Where the architecture does not provide hardware support for atomic compare and swap (CAS), atomicity is provided by a restartable sequence or by a spinlock. The chosen method is not ordinarily distinguishable by or visible to users of the interface. The following architectures can be assumed to provide CAS in hardware: alpha, amd64, i386, powerpc, powerpc64, sparc64. Scope and Restrictions If hardware CAS is available, the atomic operations are globally atomic: operations within a memory region shared between processes are guar- anteed to be performed atomically. If hardware CAS is not available, it may only be assumed that the operations are atomic with respect to threads in the same process. Additionally, if hardware CAS is not available, the atomic operations must not be used within a signal handler. Users of atomic memory operations should not make assumptions about how the memory access is performed (specifically, the width of the memory access). For this reason, applications making use of atomic memory operations should limit their use to regular memory. The results of using atomic memory operations on anything other than regular memory are undefined. Users of atomic memory operations should take care to modify any given memory location either entirely with atomic operations or entirely with some other synchronization mechanism. Intermixing of atomic operations with other synchronization mechanisms for the same memory loca- tion results in undefined behavior. Visibility and Ordering of Memory Accesses If hardware CAS is available, stores to the target memory location by an atomic operation will reach global visibility before the operation completes. If hardware CAS is not available, the store may not reach global visibility until some time after the atomic operation has com- pleted. However, in all cases a subsequent atomic operation on the same memory cell will be delayed until the result of any preceeding oper- ation has reached global visibility. Atomic operations are strongly ordered with respect to each other. The global visibility of other loads and stores before and after an atomic operation is undefined. Applications that require synchronization of loads and stores with respect to an atomic operation must use memory barriers. See membar_ops(3). Performance Because atomic memory operations require expensive synchronization at the hardware level, applications should take care to minimize their use. In certain cases, it may be more appropriate to use a mutex, especially if more than one memory location will be modified. SEE ALSO
atomic_add(3), atomic_and(3), atomic_cas(3), atomic_dec(3), atomic_inc(3), atomic_or(3), atomic_swap(3), membar_ops(3) HISTORY
The atomic_ops functions first appeared in NetBSD 5.0. BSD
April 14, 2010 BSD
All times are GMT -4. The time now is 09:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy