flock Questions

2

Solved

I have read php's manual page on the 'file_get_contents' function which does not state anything about how 'file_get_contents` behaves with respect to php's file locking. However in the comment sect...
Crash asked 13/3, 2018 at 18:5

4

Solved

My use case is as follows: I have a program that enforces that only one instance of it can be running at any given time, so at startup it always tries to grab hold of a lock file in a standard loca...
Blanc asked 16/3, 2015 at 0:23

3

I am having trouble figuring out why flock() is not behaving properly in the following scenario. The following code is placed into two different PHP scripts one "test1.php" and the other "test2.ph...
Content asked 26/6, 2014 at 21:42

3

Solved

I have cron job to run node.js scripts. Want to use flock to lock a file to make sure my cron jobs are not overlapped. Any good module for doing file locking ? Or I should call that in child pro...
Armilla asked 12/4, 2011 at 9:26

2

Solved

In C programming, is there a way to achieve timeout on flock()? Thanks. #include <sys/file.h> int flock(int fd, int operation);
Wooldridge asked 9/11, 2015 at 17:38

2

Will flock or lockf work on a directory? I there another way to lock a directory in C on a linux machine?
Diez asked 11/1, 2012 at 9:31

3

I wrote a simple go application and added a flock system to prevent being running twice at the same time: import "github.com/nightlyone/lockfile" lock, err := lockfile.New(filepath.Join(os.TempDi...
Rojas asked 26/3, 2019 at 16:17

3

Solved

In PHP, how can I test if a file has already been locked with flock? For example, if another running script has called the following: $fp = fopen('thefile.txt', 'w'); flock($fp, LOCK_EX);
Watters asked 25/12, 2013 at 10:37

4

Solved

Greetings all. I'm setting up a cron job to execute a bash script, and I'm worried that the next one may start before the previous one ends. A little googling reveals that a popular way to address ...
Insomnolence asked 26/12, 2009 at 20:35

2

Solved

I am using bash and flock on centos. Normally I would run cd /to/my/dir && python3.6 runcommand.py But then we add it to cron and don't want output so add > /dev/null 2>&1 And...
Plosive asked 27/10, 2017 at 20:44

8

Is there a flock command on Mac OS X that manages file lock? http://linux.die.net/man/1/flock
Bartram asked 10/5, 2012 at 2:10

1

I am looking at the flock docs: http://www.tutorialspoint.com/unix_system_calls/flock.htm https://linux.die.net/man/1/flock I have this: #!/usr/bin/env bash temp_dir="$HOME/temperton/tmp...
Inebriate asked 9/6, 2019 at 6:7

7

Solved

PHP's documentation page for flock() indicates that it's not safe to use under IIS. If I can't rely on flock under all circumstances, is there another way I could safely achieve the same thing?
Bough asked 6/8, 2011 at 14:43

4

What ways are there available, for exclusively opening a device file (say, the display frame buffer)? [Info: I already know about flock() & friends, which have an effect only when the other app...
Austin asked 2/4, 2013 at 11:17

4

context I'm slowly writing a specialized web server application in C++ (using the C onion http server library and the JSONCPP library for JSON serialization, if that matters)., for a Linux system ...
Germicide asked 29/12, 2011 at 11:58

3

Solved

I'm studing the flock mecanism in PHP and I'm having a hard time understanding the functionality of the LOCK_SH mode. I read on a site that it locks the file so that other scripts cannot WRITE in i...
Foilsman asked 8/12, 2013 at 10:41

3

Solved

I'm using flock() for inter-process named mutexes (i.e. some process can decide to hold a lock on "some_name", which is implemented by locking a file named "some_name" in a temp directory: lockfil...
Retention asked 17/7, 2013 at 19:46

3

Solved

Scenario: I have many processes running that need to fetch files over the net. If the file is already downloaded, I want it cached on disk. If another process is downloading the file, block until i...
Liverish asked 27/6, 2013 at 20:34

4

Solved

I have a website where at the same moment, there can be multiple users writing to the same file at the same time. An example of my code is below. PHP 5.6.20 <?php $root=realpath($_SERVER["DOCU...
Janeth asked 2/9, 2017 at 18:9

1

Solved

flock() is PHP's portable advisory file locking function. They explicitly promote that it even works under windows: flock() allows you to perform a simple reader/writer model which can be used o...
Bligh asked 20/11, 2016 at 23:12

14

Solved

What is the simplest/best way to ensure only one instance of a given script is running - assuming it's Bash on Linux? At the moment I'm doing: ps -C script.name.sh > /dev/null 2>&...
Surtax asked 11/11, 2009 at 13:21

1

Solved

I want to get output from two processes and merge them into one file, like: proc1 >> output & proc2 >> output & The problem is that output may be mixed up in the final file. Fo...
Aerify asked 21/8, 2016 at 6:59

1

I have read enough posts on stackoverflow regarding the difference between flock/lockf/fcntl but I am unable to answer the below observation: >>> import fcntl >>> a = open('/tmp/l...
Eulaeulachon asked 12/2, 2015 at 5:50

2

Flock is a reasonably new iOS app from the guys at Bump, which has an interesting feature. It somehow knows when photos have been taken by another app, notifies the user (in a notification center w...
Complete asked 10/1, 2013 at 23:14

3

Solved

I need to run a python script (job.py) every minute. This script must not be started if it is already running. Its execution time can be between 10 seconds and several hours. So I put into my cron...
Widespread asked 27/5, 2011 at 0:21

© 2022 - 2025 — McMap. All rights reserved.