Linked Questions
11 questions linked to/from What Unix commands can be used as a semaphore/lock?
1
vote
1
answer
801
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 don't have ...
0
votes
1
answer
366
views
How to safely create file in bash [duplicate]
I have a script that creates a temporary file as a flag to guard against the script being run simultaneously. Currently it uses tempfile, e.g.
if ! tempfile -n /tmp/updating > /dev/null; then
...
75
votes
13
answers
77k
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. ...
5
votes
2
answers
7k
views
Can a crontab job run concurrently with itself?
If I have a crontab job that runs, for instance, every hour, but that job may take more than an hour to complete, will the next job fail to run?
2
votes
1
answer
3k
views
Script to check a folder, print the files then delete those files
I am looking for some guidance on creating a script that will check a specific folder, print all documents (if any) and then delete those documents. I would also like to run this script as a cron job. ...
2
votes
3
answers
3k
views
How do I run a script n times at same time and how do I simulate a semaphore?
I have a text file, inside of this file is a number, and I have a script.sh in ksh.
The script reads the file and gets the number, then increases the number by 1 and overwrites the new number in the ...
1
vote
1
answer
1k
views
Getting empty data while reading text file and send read data to url by cURL in linux
I have text file called read_data.txt in /var/www/html/ directory. I want to read data by curl while file contents will change. So I have created a bash script. It is reading data while the content is ...
4
votes
1
answer
382
views
How can I run keychain in a way that only has the first shell prompt for keys on startup?
I open multiple shell tabs when I start KDE, and I've just added keychain to my ~/.shellrc the problem is that all the tabs prompt for key passwords when I login. This is quite annoying to do this. Is ...
2
votes
3
answers
401
views
perform a read only if file is closed
I am facing an issue where I have to write a shell script to read a file only if it is not used or under write by any other program. I cannot use lsof as this script is going to run on the embedded ...
1
vote
0
answers
518
views
Is this flock usage with if-else safe?
I have two shell scripts that may be run in parallel but may also be run one at a time. Both scripts rely on an initial setup step that takes a while and can't be run by both at the same time.
To ...
0
votes
1
answer
162
views
Update contents of a directory and a file that has meta about the dir safely
I have a script that copies a local file to a remote directory and updates a remote file with a new line that mentions the just copied script.
Some times some of the files in the remote directory need ...