Sponsored Content
Top Forums Shell Programming and Scripting Avoid locking between two files: Post 302862075 by ctsgnb on Thursday 10th of October 2013 06:11:46 AM
Old 10-10-2013
Your scripts should use a flag to avoid conflict.

This flag should be created using an atomic operation (like mkdir or using clobber stuff).

Atomic means that if your both script tries to setup the flag at the same time, only one of them will pass and the second will fail.

But you will then have to check against the successful creation of the flag before your script run and erase the flag when it ends.

Last edited by ctsgnb; 10-10-2013 at 09:15 AM..
 

9 More Discussions You Might Find Interesting

1. Ubuntu

Avoid creating temporary files on editing a file in Ubuntu

Hi, My ubuntu flavor always create temporary files having filename followed by ~ on editing. For eg: if I am editing a file called "sip.c", automatically a temporary (bkup) file is getting created with the name "sip.c~". How to avoid this file creation? (7 Replies)
Discussion started by: royalibrahim
7 Replies

2. Programming

What is the proper way to combine C++ files (with g++) to avoid link (ld) errors?

Problem background: gcc v 4.1 2 .cpp files, 2 .h files Files: main.cpp a.cpp a.h b.h Organization: main.cpp includes a.h (because it calls a.cpp code) a.cpp includes a.h a.h includes b.h (because a class in a.h uses a b.h class) There is no inheritance between a.h or b.h or any of... (1 Reply)
Discussion started by: johnqsmith
1 Replies

3. Shell Programming and Scripting

Avoid files being archived

hi all, i want to write a shell script which can automatically touch my all files within a folder in an interval of 90 days ...so that i can avoid them being archived. I don't want to manually touch the all files instead i want an automated shell script to do this. Thanks in advance, Om (3 Replies)
Discussion started by: koti
3 Replies

4. Shell Programming and Scripting

How to Avoid intermediate files when pipe does nt work

problem with piping one output to another.Would like to avoid the intermediate file creation.The piping does nt work on places where files have been created and goes in an endless loop. sed -e "s/^\.\///g" $LINE1| sed -e "s/_\(\)/kkk\1/g" > $file1 tr -s '_' ' ' < $file1| \ sort -n -k... (1 Reply)
Discussion started by: w020637
1 Replies

5. Shell Programming and Scripting

How to avoid duplication within 2 files?

Hi all, Actually 2 files are there - file1, file2. file1 contains ---> london mosco america russia mosco file2 contains --> europe india japan mosco england london Question is I want to print all the city names without duplication cities in those... (10 Replies)
Discussion started by: balan_mca
10 Replies

6. UNIX for Advanced & Expert Users

Samba - prevent locking of selected files over network?

I have a samba server which is serving a mixture of files. One main application uses a data file and creates a temporary working execution file at startup and holds that temp execution file open for the duration of the program's execution (but doesn't use the file at all after initial startup). ... (0 Replies)
Discussion started by: humbletech99
0 Replies

7. Shell Programming and Scripting

Joining 3 AWK scripts to avoid use "temp" files

Hi everyone, Looking for a suggestion to improve the below script in which I´ve been working. The thing is I have 3 separated AWK scripts that I need to apply over the inputfile, and for scripts (2) and (3) I have to use a "temp" file as their inputfile (inputfile_temp and inputfile_temp1... (2 Replies)
Discussion started by: cgkmal
2 Replies

8. Ubuntu

Avoid typing long filenames in terminal, shortcut for selecting files?

You probably know the answer to this, because I know it exists. I have super long filenames with md5 hashes and I sucks to type the whole hash in the console. Because... just because :P What is the shortcut for selecting a file in the current directory? Like you get a sort of loop through the... (1 Reply)
Discussion started by: hellfire1
1 Replies

9. AIX

How to avoid errors when moving files in a bff?

I am building a bff using mkinstallp. My template file is : Package Name: svr_exForum Package VRMF: 7.2 Update: N Fileset Fileset Name: svr_exForum.rte Fileset VRMF: 7.2 USRLIBLPPFiles Pre-installation Script: /lppdir/lpp/exForum/F_pre_i ... (2 Replies)
Discussion started by: kevinl
2 Replies
getpflags(2)                                                                                                                          getpflags(2)

NAME
getpflags, setpflags - get or set process flags SYNOPSIS
#include <sys/types.h> #include <priv.h> uint_t getpflags(uint_t flag); int setpflags(uint_t flag, uint_t value); The getpflags() and setpflags() functions obtain and modify the current per-process flags. The following values for flag are supported: PRIV_AWARE This one bit flag takes the value of 0 (unset) or 1 (set). Only if this flag is set is the current process privilege- aware. A process can attempt to unset this flag but might fail silently if the observed set invariance condition cannot be met. Setting this flag is always successful. See privileges(5) for a discussion of this flag. PRIV_DEBUG This one bit flag takes the value of 0 (unset) or 1 (set). Only if this flag is set does the current process have privi- lege debugging enabled. Processes can set and unset this flag at will. The getpflags() returns the value associated with a given per-process flag. If the flag argument is invalid, (uint_t)-1 is returned and errno is set to indicate the error. Upon successful completion, setpflags() returns 0. Otherwise, -1 is returned and errno is set to indicate the error. The getpflags() and setpflags() functions will fail if: EINVAL The value of flag or the value to which the flag is set is out of range. The setpflags() function will fail if: EPERM An attempt was made to unset PRIV_AWARE but the observed set invariance condition was not met. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ ppriv(1), attributes(5), privileges(5) 7 Mar 2005 getpflags(2)
All times are GMT -4. The time now is 05:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy