I want to be able to lock a file for 60 minutes so that an automated monitoring program will not execute the script more that once an hour. I have never used a lock file but have heard that is what I need to use. Does anyone have any examples of how I would use this?
lock 60 filename.ksh ---?... (6 Replies)
Hi,
I want to do the foll steps:
1. Check if someone has a lock on my file1.
2. if file1 is locked by any other user
wait in a loop till another user releases lock
3. when lock released, lock file1.
4. do procesing (write) on file1.
5. processing complete. release lock on file1.
... (2 Replies)
Hi,
I want to list out all files which are lock by some process.
ex- ~/critical
I want to list all files in critical directory which has been locked.
I need this very badly. Any suggestion highly appriciated.
Regards,
Ashok (1 Reply)
using OS X and the Terminal, I'd like to find all locked files in a specified directory, unlock them, and print a list of those files that were unlocked
how can I do this?
I'm familiar with chflags nouchg for unlocking one file but not familiar with unix enough to do what I'd like.
Thanks! (0 Replies)
Hi Guys.
This is part of my filesystem structure :
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d0 47G 5.2G 42G 12% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% ... (2 Replies)
All,
Is there a way to keep checking for a file over and over again in the same script for an interval of time?
Ie
If {
mail -user
continue checking until file arrives
file arrives
tasks
exit
I don't want the script to run each time and email the user each time a file... (4 Replies)
Dear community,
I've a continuos tcpdump on redhat that close the dumped file every 100000 captured packets.
To avoid disk full I would like to gzip the closed *.cap file. But how can I check if the file is currently opened by tcpdump and skip it from gzip?
Thanks!
EDIT: Just to post an... (9 Replies)
HI Guys,
I have some 8 files with different name and extensions. I need to check if they are present in a specific folder or not and also want that script to show me which all are not present. I can write if condition for each file but from a developer perspective , i feel that is not a good... (3 Replies)
I was trying to read the file to create a table in SAS and I got error as follows while I read.
Resource is write-locked by another user. File
=/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-09-29_tmp_18208.log. System Error Code =
0.
ERROR: File is in... (10 Replies)
Hi Experts,
I am beginner to shell scripting, I have a archive script which will connect to the FTP server and archive the files from FTP source location to FTP archive location.
Now the problem here is, the script working for few files and not working for few.I am facing the below error... (1 Reply)
Discussion started by: spidy
1 Replies
LEARN ABOUT OSF1
sem_wait
sem_wait(3) Library Functions Manual sem_wait(3)NAME
sem_wait, sem_trywait - Performs (or conditionally performs) a semaphore lock (P1003.1b)
LIBRARY
Realtime Library (librt.so, librt.a)
SYNOPSIS
#include <semaphore.h>
int sem_wait (
sem_t *sem);
int sem_trywait (
sem_t *sem);
PARAMETERS
sem Specifies a pointer to the semaphore to be locked.
DESCRIPTION
The sem_wait function locks the semaphore referenced by sem by performing a semaphore lock operation on it. If the semaphore value is zero,
the sem_wait function blocks until it either locks the semaphore or is interrupted by a signal.
The sem_trywait function locks a semaphore only if the semaphore is currently not locked. If the semaphore value is zero, the sem_trywait
function returns without locking the semaphore.
These functions help ensure that the resource associated with the semaphore cannot be accessed by other processes. The semaphore remains
locked until the process unlocks it with a call to the sem_post function.
Use the sem_wait function instead of the sem_trywait function if the process should wait for access to the semaphore.
RETURN VALUES
If the sem_wait or sem_trywait function returns successfully, a value of 0 (zero) is returned and the function executes the semaphore lock
operation.
On an unsuccessful call, a value of -1 is returned and errno is set to indicate that an error occurred. The state of the semaphore remains
unchanged.
ERRORS
The sem_wait and sem_trywait functions fail under the following conditions:
[EAGAIN] The semaphore was already locked and cannot be locked by the sem_trywait operation (sem_trywait only).
[EINTR] A signal interrupted this function.
[EINVAL] The sem argument does not refer to a valid semaphore.
RELATED INFORMATION
Functions: sem_post(3)
Guide to Realtime Programming delim off
sem_wait(3)