Sponsored Content
Operating Systems AIX Locking a file when using VI to prevent multiple-edit sessions by diff users Post 302095812 by Browser_ice on Friday 10th of November 2006 09:17:11 AM
Old 11-10-2006
locking via shell script ?

Isn't there a unix (AIX) command that can lock or unlock a file ?

That way we could simply execute a small script that would do :

if file not locked
lock file
vi file
unlock file
else
echo "file being edited"
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Prevent file from being mailed multiple times from a job

We have a ksh which runs once every 15 minutes. Based on a certain condition (for invalid data) we are spooling a file and if the file is of length greater than 0 bytes, then we are mailing this file to a group of users. Upon receiving the file, users correct the data so that on its next run the... (2 Replies)
Discussion started by: Sree_2503
2 Replies

2. AIX

Users Are Getting Kicked out of 2Hr Sessions

:confused:We've had close to 100 calls about users logging into our AIX server. The users open up about 3 to 5 sessions in the server. After 2hrs of idle time, users are frozen or stuck in the IBM UniVerse Application. We (system administrators) have been blaming the application (which we'll take... (2 Replies)
Discussion started by: Sarccastik Dude
2 Replies

3. Solaris

Prevent users logging in as root

I would like to know how to prevent users connecting to a server using SSH as root. I would still like them to be able to login with their username and then change to su. But I would like to prevent them logging in directly as root. I have searched the forum and read that I should set... (3 Replies)
Discussion started by: Sepia
3 Replies

4. Solaris

locking a users file as root

hello, I have a challenge to find a way to lock down a file in a user's home directory, such that a user can NOT modify, rename, move, delete, etc. The solution needs to be deployable without, for example, having to switch from unix to windows, etc We are using NFS. We want to lock the... (1 Reply)
Discussion started by: jvmagic
1 Replies

5. 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

6. UNIX for Dummies Questions & Answers

In vi, any way to prevent :edit from repositioning the screen?

I am working on a project where I need to make many changes to files, both inside and outside of the vi editor. I make small changes manually right in vi, and I have a script that I run from another session that I use to make bigger changes to the files using sed. After running my script from... (2 Replies)
Discussion started by: RickS
2 Replies

7. HP-UX

Users getting kicked out of sessions

We have an old (11.11) HP-UX system. A couple of months ago, our customers started having problems with their logins. After sitting idle for roughly an hour, their screens would lock up and they would be kicked out of the system. This happens if they are in the application or on the command... (2 Replies)
Discussion started by: slkdnichols
2 Replies

8. Shell Programming and Scripting

Need Help to Edit multiple column of a file

Hello Team, I want to know if there is any one liner command , using which I can edit multiple column of a file. input file input.txt (comma separated), taran, 12.45, uttam, 23.40, babay karan, 12.45, raju, 11.40, rahulg I want to update, 2nd and 4th column, but want all those column... (8 Replies)
Discussion started by: Uttam Maji
8 Replies

9. AIX

Telnet sessions stay as idle users

Hi The telnet sessions stay as idle users. It is not getting kicked out. Please advise what could be the issue. only when we reboot the server these telnet sessions goes. Below is the current output from the server. we rebooted the server three days ago: pmut6:/> uptime 04:21PM... (8 Replies)
Discussion started by: newtoaixos
8 Replies

10. UNIX for Beginners Questions & Answers

Find number of ACTIVE SSH putty sessions, excluding where the user hopped on to a diff server

Hi - If iam logged on to server A, on 4 putty windows using SSH ... and out of these 4 logged-in sessions, in one of the sessions if i did SSH from server A to server B; i would now have 4 putty windows sessions ... of which 3 are actively logged on to Server A while 1 putty window is actively... (2 Replies)
Discussion started by: i4ismail
2 Replies
pthread_mutex_lock(3T)													    pthread_mutex_lock(3T)

NAME
pthread_mutex_lock(), pthread_mutex_trylock() - lock or attempt to lock a mutex SYNOPSIS
PARAMETERS
mutex Pointer to the mutex to be locked. DESCRIPTION
The mutex object mutex is locked by calling the function. How the calling thread acquires the mutex is dependent upon the type attribute for the mutex. This operation returns with the mutex object referenced by mutex in the locked state with the calling thread as its owner. If the mutex type is deadlock detection is not provided. Attempting to relock the mutex causes deadlock. If a thread attempts to unlock a mutex that it has not locked or a mutex which is unlocked, undefined behavior results. If the mutex type is the mutex maintains the concept of an owner. If a thread attempts to relock a mutex that it has already locked, an error shall be returned. If a thread attempts to unlock a mutex that it has not locked or a mutex that is unlocked, an error shall be returned. If the mutex type is then the mutex maintains the concept of an owner and a lock count. When a thread successfully acquires a mutex for the first time, the count field shall be set to one. Every time a thread relocks this mutex, the count field shall be incremented by one. Each time the thread unlocks the mutex, the count field shall be decremented by one. When the count field reaches zero, the mutex shall become available for other threads to acquire. If a thread attempts to unlock a mutex that it has not locked, an error shall be returned. If the mutex type is deadlock detection is not provided. Attempting to relock the mutex causes deadlock. A thread can unlock a mutex that it has not locked. Attempting to unlock an unlocked mutex results in undefined behavior. If the mutex type is attempting to recursively lock the mutex results in undefined behavior. Attempting to unlock the mutex if it was not locked by the calling thread results in undefined behavior. Attempting to unlocked the mutex if it is not locked results in undefined behavior. The function is identical to the function except that if the mutex object referenced by mutex cannot be acquired after one attempt, the call returns immediately with an error. If a signal is delivered to a thread waiting for a mutex, upon return from the signal handler, the thread shall resume waiting for the mutex as if it was not interrupted. RETURN VALUE
Upon successful completion, and return zero. Otherwise, an error number is returned to indicate the error (the variable is not set). ERRORS
If any of the following occur, the and functions return the corresponding error number: [EINVAL] mutex is a mutex and the caller's priority is higher than mutex's priority ceiling. If any of the following occur, the function returns the corresponding error number: [EBUSY] mutex is currently locked by another thread. If any of the following occur, the and functions return the corresponding error number: [EAGAIN] mutex could not be acquired because the maximum number of recursive locks for mutex has been exceeded. This error is not detected on HP-UX. [EINVAL] mutex is not an initialized mutex. [EFAULT] mutex parameter points to an illegal address. If any of the following occur, the function returns the corresponding error number: [EDEADLK] The current thread already owns the mutex. This error will be detected only for mutexes on HP-UX. WARNINGS
A recursive mutex can be locked more than once by the same thread without causing that thread to deadlock. Undefined behavior may result if the owner of a recursive mutex tries to lock the mutex too many times. AUTHOR
and was derived from the IEEE POSIX P1003.1c standard and X/Open SEE ALSO
pthread_mutex_init(3T), pthread_mutex_destroy(3T), pthread_mutex_unlock(3T). STANDARDS CONFORMANCE
Pthread Library pthread_mutex_lock(3T)
All times are GMT -4. The time now is 12:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy