The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
2answers
48 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
37 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 # ...
1
vote
2answers
34 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
42 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 ...
3
votes
1answer
67 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), ...
3
votes
1answer
106 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, ...
2
votes
2answers
213 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 ...
4
votes
2answers
387 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 ...
2
votes
0answers
86 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 ...
2
votes
2answers
360 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
131 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 ...
4
votes
2answers
4k 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 ...
8
votes
1answer
248 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 ...
2
votes
1answer
6k 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 ...
2
votes
1answer
95 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
1answer
136 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
139 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
1answer
190 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 ...
2
votes
1answer
168 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
0answers
74 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 ...
1
vote
1answer
183 views

How do I ensure that only one instance of my ksh script runs on Solaris using NFS? [duplicate]

Possible Duplicate: What Unix commands can be used as a semaphore/lock? I have read many similar post and the solution seems to be to use flock. flock does not exist on my system and I ...
3
votes
1answer
892 views

Lock CD/DVD drive (prevent eject) [duplicate]

On my laptop the eject button for the CD/DVD drive is placed in a very unfortunate position and I hit it a dozen times per day and the tray pops out. I found many solutions which seemed to work for ...
4
votes
4answers
2k views

Gedit won't save a file on a VirtualBox share: Text file busy

I have a text file that I can change using other applications (for example openoffice). But when I try to change and save it using gedit, I am getting error from gedit: Could not save the file ...
7
votes
4answers
2k views

How to make sure only one instance of a bash script runs?

A solution that does not require additional tools would be prefered.
3
votes
1answer
201 views

Locking in a shell script

I want to write a long-running shell script so that only one copy could be run at a time. If the script crashes, I want a new invocation of the script not to be stopped by a lock from the crashed ...
13
votes
2answers
1k views

Does redirecting output to a file apply a lock on the file?

If I have a command $ ./script >> file.log that gets called twice, with the second call occurring before the first one ends, what happens? Does the first call get an exclusive lock on the ...
1
vote
1answer
2k views

Is there a better way to unlock a file than move and copy?

My organisation uses Debian Linux running Samba for office file servers. Users run Outlook for their email, which crashes fairly regularly and leaves the outlook.pst file locked. Currently, our ...
3
votes
1answer
659 views

Lock file from being edited or deleted

I have CentOS and cPanel installed. I want to lock certain files (e.g. .ftpquota) from being deleted through FTP. I tried to change the ownership to root:root or root:lock but it didn't work; neither ...
1
vote
1answer
1k views

How to trace file locks (per directory)

I'm quite new to Linux and I have not really a clue on how to do this. I've got a directory and I'd like to monitor (output to shell) when a file inside that directory get's a file lock and when it ...
26
votes
9answers
11k views

Correct locking in shell scripts?

Sometimes you have to make sure that only one instance of a shell script is running at the same time. For example a cron job which is executed via crond that does not provide locking on its own (e.g. ...
1
vote
1answer
3k views

How do you make a cross-process locking in Linux (C/C++)?

I need to make sure one process executes only in one instance at a time. On Windows you could use named mutex. But I have no idea what to use on Linux. I think I've seen an approach were app creates ...
3
votes
3answers
2k views

How to lock on Solaris 10?

On Linux I use flock lock command to execute a command with an exclusive lock. What is the standard operating system command of Solaris 10 to do the same in a shell?
14
votes
3answers
6k views

What are pid and lock files for?

I often see that programs specify pid and lock files. And I'm not quite sure what they do. For example, when compiling nginx: --pid-path=/var/run/nginx.pid \ --lock-path=/var/lock/nginx.lock \ Can ...
13
votes
3answers
47k views

How to get over “device or resource busy”?

I tried to rm -rf a folder, and got "device or resource busy". In Windows, I would have used LockHunter to resolve this. What's the linux equivalent? (Please give as answer a simple "unlock this" ...
8
votes
3answers
13k views

what is the difference between spin locks and semaphores?

What are the basic differences between spin locks and semaphores in action?
17
votes
4answers
15k views

What is a spinlock in Linux?

I would like to know about spinlocks in detail? Could someone explain that to me?