The tag has no usage guidance.

learn more… | top users | synonyms

2
votes
1answer
22 views

Bash, fork with CLOEXEC

Can Bash execute a subprocess while preventing a subprocess from inheriting a file descriptor? if flock -nx 9 then # If begin program runs away, it will keep the lock. begin program else echo "...
1
vote
0answers
23 views

Avoid starvation using flock with 2 process with write and read lock

I have two scripts let's call them script1 and script2. The script1 is scheduled every 2 minutes and it takes 4 minutes to execute the script2 is scheduled every 30 minutes and it takes 4 minutes to ...
0
votes
1answer
23 views

use of lockfile in script and it significance

I have a code in which below line is used due to which i got stuck.I have hunted the web but did not understand well.just got to know the basic set of info as below lockfile can be used to create one ...
0
votes
0answers
37 views

How do I prevent LightDM from being used as a screensaver on Manjaro?

I've recently installed Manjaro 15.02 (which has been upgraded to 16.06-rc1 since) on my Dell Latitude Laptop, nVidia + Intel graphics (Optimus, I believe) but I'm using only the nVidia graphics. I've ...
1
vote
0answers
37 views

Can't launch Synaptic due to stale lock [closed]

I'm using PCLinuxOS, last time I tried to launch Synaptic I got warning: cleaning stale lock Illegal instruction Same happens if I try stuff like apt-cache check. Deleting /root/.synaptic/...
1
vote
2answers
58 views

Linux file hierarchy - what's the best location to store lockfiles?

I want to synchronize processes based on lock files (/ socket files). These files should only be removable by their creator user. There are plenty of choices: /dev/shm /var/lock /run/lock /run/...
0
votes
1answer
55 views

Subversion E000037: Can't get exclusive lock on file 'db/txn-current-lock': No locks available

When I try to commit a change to a Subversion repository, and I get error messages of the form svn: E000037: Commit failed (details follow): svn: E000037: Can't get exclusive lock on file '/path/to/...
1
vote
0answers
29 views

How long does process wait for locked file? [closed]

If a process in a Unix based OS finds that a file is locked because another process is writing to it, how long does it wait and retry before giving up and returning an error?
1
vote
1answer
25 views

Executing shell script parallelly and in background skips some operation

del_client.sh --delete client1 & del_client.sh --delete client2 & del_client.sh --delete client3 & del_client.sh --delete client4 & When I executed the commands above in the ...
0
votes
0answers
5 views

Can Samba 3.5.16 handle 64 bit lock requests

I am having trouble with my win10 box sending lock offset requests to my Seagate Central NAS running Samba 3.5.16. The lock offset request is in 64 bit format. The response is success but wireshark ...
-1
votes
1answer
22 views

Lock a Application Through Terminal

I was wondering if it were possible to lock a Application through Mac Terminal. I know there's a way to lock files, using chmod a+x 000 'directory', but it never worked with an Application. What I ...
0
votes
1answer
41 views

How do I check if a directory is locked or not in bash?

I have only been able to find solutions for files, and not directories, like lsof. chflags has no read option, so I don't know how to do it.
0
votes
1answer
92 views

Mandatory Locking in Unix

In Unix record locking is the technique used to lock the portion of a file for certain amount of time to maintain consistency of the data from concurrent access to the file. On this mechanism, ...
1
vote
1answer
101 views

apt-get wait for lock release

If you are running apt-get commands on terminal and want to install stuff on the software center, the center says it waits until apt-get finishes. I wanted to know if it is possible to do the same but ...
0
votes
1answer
42 views

Accidentally deleted lock folder

I am a beginner in Ubuntu. I executed the following command: sudo rm /var/lib/apt/lists/lock due to the solution I got from here. Now my system gets hanged more frequently while running several ...
2
votes
1answer
1k views

NFS file locking not working, am I misunderstanding?

I'm planning on having a complicated file sharing setup, and want to make sure I don't destroy file locking. (Wanting to use bind mounting, nfs, nfs over rdma (InfiniBand file sharing), and virtfs (...
1
vote
0answers
35 views

Is NFS file locking destroyed by the nfs server bind-mounting the directory being nfs shared?

I have a directory /persistent/pacmanPkgCache which is both: nfs-shared to other machines bind-mounted to /var/cache/pacman/pkg Does having this directory nfs-shared and bind-mounted at the same ...
1
vote
1answer
168 views

Does linux have file locking protection when trying to rename/deleting files

I have a cron job that kicks off a new process every day. The process runs every 5 minutes and appends to a log file. Another cron job runs every 60 minutes. It takes some of the data in the log file,...
9
votes
2answers
1k views

Is flock & exec safe in bash?

The "standard" locking snippet I've seen goes something like... ( flock -n 200 || exit 1; # do stuff ) 200>program.lock Is it safe (testing seems to say so) to use exec at that point? ...
2
votes
2answers
149 views

Linux lockfile starvation

I want to use lockfile functionality for a bash script that will run in parallel. The problem is that in a functionality as in the script below, a starvation can happen in case that the first one to ...
2
votes
1answer
598 views

Generic shared resource locking techniques - is flock the solution?

I need to implement a locking scheme so that multiple processes can share a set of resources, while a "special" process can obtain exclusive access to that set of resources. These are batch ...
5
votes
1answer
267 views

How to make sure only one instance accessing the file at a time in a folder?

I have a shell script which will be executed by multiple instances and if an instance accessing a file and doing some operation how can I make sure other instances are not accessing the same file and ...
8
votes
2answers
765 views

How can I tell when a process has finished writing to a file?

I have a process which has been spawned from a shell. It is running as a background process and exporting a DB to a CSV file in /tmp. How can I tell when the background process has completed (...
1
vote
1answer
4k views

Are lock, mutex, and semaphore for between threads or between processes?

I think lock, mutex, semaphore are used for synchronized multiple (threads or processes?) to access something simultaneously. Must this "something" be some shared memory between multiple (threads or ...
1
vote
2answers
306 views

Remove unneeded file lock in script

I have some script using flock executable. It works well. Problem is when this script calls another script, and it creates background process. In this situation background process inherits file locked ...
4
votes
1answer
958 views

What is advisory locking on files that Unix systems typically employs?

I read that Unix like system typically use advisory locking for file IO vs mandatory locking used by Microsoft OS's. If I understood correctly in mandatory locking file lock is enforced by the OS ...
0
votes
1answer
579 views

Cannot lock group file: already locked

I'm trying to add a group using this command: groupadd somegroup which returns: Cannot lock group file: already locked. I did some research and most of the solutions require removing a lock file ...
2
votes
1answer
610 views

Controlling bash script concurrency, flock inheritance

I have a bash deployment script that handles deploying updated code to a Tomcat instance on CentOS, however, both Chef and RunDeck may invoke the script, and since Chef runs periodically there is a ...
7
votes
3answers
627 views

Why do package managers need lock files?

dpkg uses a lock file (/var/lib/dpkg/lock), when in use. Why are these lockfiles needed? Why are multiple instances not possible?
5
votes
1answer
544 views

Is `ln` atomic and reliable on NFS? Could NFS replace GFS in this use case?

I have a cluster with a bunch of servers with a shared disk containing a GFS global file system that all nodes access simultaneously. Each node in the cluster run the same program (a shell script is ...
3
votes
2answers
274 views

Can I safely read a file that is appended to by another process?

If process A copies files to some location loc and process B regularly copies the files from loc to some other location, can B read a file that is currently in the process of being copied to loc by A? ...
2
votes
1answer
408 views

Locking console when computer suspends/hibernates

In X I've used the following script (from here) to lock the computer with i3lock each time pm-suspend or pm-hibernate are invoked. /etc/pm/sleep.d/00screensaver-lock: #!/bin/sh # 00screensaver-...
1
vote
2answers
269 views

Lock console session

I've set up a no-x/console only system running a minimal install of debian jessie/testing. For this system I need a screen locker to lock the entire session when I'm away. vlock would be appropriate ...
0
votes
1answer
93 views

How to completely close linux from outside world? [closed]

This is theoretical question that seems to be interesting (at least for me). What would you do to completely close the whole system from outside world? By close I mean that any human shouldn't be able ...
4
votes
1answer
929 views

file corresponds to /proc/locks

$ cat /proc/locks 1: POSIX ADVISORY WRITE 458 03:07:133880 0 EOF 2: FLOCK ADVISORY WRITE 404 03:07:133879 0 EOF The fields are: ordinal number(1), type(2), mode(3), type(4), pid(5), maj:min:inode(...
5
votes
2answers
2k views

Pass multiple commands to flock

flock -x -w 5 ~/counter.txt 'COUNTER=$(cat ~/counter.txt); echo $((COUNTER + 1)) > ~/counter.txt' How would I pass multiple comands to flock as in the example above? As far as I understand, ...
6
votes
2answers
5k views

Obtain exclusive read/write lock on a file for atomic updates

I want to have a file that is used as a counter. User A will write and increment this number, while User B requests to read the file. Is it possible that User A can lock this file so no one can read ...
7
votes
2answers
11k views

How to lock my session in Xfce?

I am looking a simple way to lock my session in Xfce (Debian Unstable). I don't want to have to write my password at every wake-up but I want to be able to press to a shortcut (which launches a ...
4
votes
1answer
534 views

xautolock: how to auto-unlock on user activity?

I need to run a script after a period of user inactivity. For that I use the wonderful program xautolock. Now, I also need to run another script when the activity is resumed (e.g. mouse is moved or a ...
3
votes
2answers
10k views

Monitoring file locks, locked using flock

I would like to get a list of pid's which hold shared lock on /tmp/file. Is this possible using simple command line tools?
0
votes
1answer
253 views

Upgrading debian squeeze to sid

Atm I am trying to upgrade my debian squeeze to sid. I followed this tutorial: www(.)digitalocean.com/community/articles/upgrading-debian-to-unstable Everything seems to work well until Step 3. While ...
20
votes
3answers
54k views

How to list processes locking file?

Using flock, several processes can have a shared lock at the same time, or be waiting to acquire a write lock. How do I get a list of these processes? That is, for a given file X, ideally to find the ...
9
votes
1answer
513 views

RasPi - USB microphone locks up

On my RasPi board, Debian Linux, the USB microphone occasionally gets locked up such that nothing can use it. The microphone has a LED which is usually flashing, when it's locked, it turns off. The ...
5
votes
1answer
49k views

How to lock users after 5 unsuccessful login tries?

How to lock users after 5 unsuccessful login tries? I gathered a few distributions/versions to how to do it, but I can't test it. RHEL4: by adding the: auth required /lib/security/$ISA/...
2
votes
2answers
493 views

Lock Parted Magic?

Is it possible to lock the Parted Magic screen so that others don't tamper with it while it's in the middle of long operations?
2
votes
2answers
331 views

Can't install anything

I'm not able to install, update or do anything else with apt-get, aptitude, dpkg and so on. The lock-file /var/lib/dpkg/lock exists from boot-time on. When I delete it and run apt-get update, it ...
1
vote
1answer
259 views

How /var/lib/dpkg/lock works?

/var/lib/dpkg/lock is file that holding a lock when "A package manager is working". But how this system works? I have /var/lib/dpkg/lock everytime when I have Linux working. When I use one of package ...
1
vote
2answers
565 views

No lockfile creation in NFS setup

I recently set up a new fileserver for our research group. The old one was running SuSE linux and, although small harddrives and a slow machine, worked fine. The clients are mostly Gentoo machines ...
3
votes
1answer
545 views

How to use lockstat.txt on Ubuntu 12.04?

I have Ubuntu 12.04 installed on my machine. I want to use lockstat. I have looked at Documentation/lockstat.txt but I am not getting how to use it, if possible please help me out. I am working on a ...
1
vote
1answer
132 views

Lock a script starting daemons

I'm run a script with cron: */10 * * * * flock -n /tmp/lock script I have to make sure that only one instance of the script is running at the same time, and for that I'm using flock. The problem is ...