02-28-2001
Ok, I understand now. Why don't you make the script test for a lockfile when it starts?
if [ -a /tmp/process.lock ]; then
exit
fi
touch /tmp/process.lock
# rest of script
rm /tmp/process.lock
9 More Discussions You Might Find Interesting
1. News, Links, Events and Announcements
The SETI@home project invites volunteers to install special software of their home computers. This software, called BOINC, runs computational jobs when the computer would otherwise be idle. And the software needs to contact the main server periodically to deliver results and obtain new problems.... (2 Replies)
Discussion started by: Perderabo
2 Replies
2. Shell Programming and Scripting
My goal is to make a script to find/replace the variable "PORT" with a unique number.
Like the following
<VirtualHost 174.120.36.236:PORT>
ServerName architect.com.ph
ServerAlias www.architect.com.ph
DocumentRoot /home/architec/public_html
ServerAdmin... (16 Replies)
Discussion started by: EXT3FSCK
16 Replies
3. Shell Programming and Scripting
How to combine 3 find statements into 1-liner?
find statements:
cd ${dir1} ; find . ! -name . -prune -type f | xargs file | grep -i ascii | cut -f1 -d: | xargs grep -l "${searchtxt}"
cd ${dir2} ; find . ! -name . -prune -type f | xargs file | grep -i ascii | cut -f1 -d: | xargs grep -l... (4 Replies)
Discussion started by: ux4me
4 Replies
4. UNIX for Dummies Questions & Answers
If I run:
find /somefolder -type f -size -7M | wc -l
I get 73594 files
But when I run
find /somefolder -type f -size -7M -exec /bin/cp -v {} /someotherfolder/ \;
it only copies 38891 of the files to the folder, why? There's a mix of all types of files in /somefolder. Is there some other... (12 Replies)
Discussion started by: unclecameron
12 Replies
5. Shell Programming and Scripting
I must go through some files to change a certain string within text files to another string. I use openSUSE and folders are mounted by cifs.
Text to be replaced (only in .m extension) is U:\FOLDER and new string is N:
That works fine with spaces in directory names etc., but this process ... (5 Replies)
Discussion started by: Pappa41
5 Replies
6. Shell Programming and Scripting
I want to search a file if it contains special strings and if yes, the records found should be mailed.
I can either do it with a temporary file:
/usr/bin/grep somestring somefile > /tmp/tempfile && /usr/bin/mail -s "Found something" email@mycomp.com < /tmp/tempfile... or by running the grep... (10 Replies)
Discussion started by: Cochise
10 Replies
7. Shell Programming and Scripting
My script triggers and e-mail if keywords supplied to it were found.
Problem is if it find the same keyword continously (due to continous server errors), it triggers mails and fillup my mail box with same message (which is not required)
I want my script to NOT to send an e-mail if it finds the... (13 Replies)
Discussion started by: Rajeshneemkar
13 Replies
8. Shell Programming and Scripting
Hi,
How would you write bash script that given a directory as an argument and finds all duplicate files (with same contents - by using bytewise comparison) there and prints their names? (6 Replies)
Discussion started by: elior
6 Replies
9. UNIX for Beginners Questions & Answers
The contents of my home directory:
bin Desktop Documents Downloads folders Music Pictures Public Templates Videos
When I run the command for file in /home/myself/*d*; do if ; then echo $file; fi; doneit finds
/home/myself/Downloads
/home/myself/Videos
but not "folders".
... (5 Replies)
Discussion started by: Xubuntu56
5 Replies
LEARN ABOUT DEBIAN
mailunlock
MAILOCK(3) Linux Programmer's Manual MAILOCK(3)
NAME
maillock, mailunlock, touchlock - manage mailbox lockfiles
SYNOPSIS
#include <maillock.h>
cc [ flag ... ] file ... -llockfile [ library ]
int maillock( const char *user, int retrycnt );
void mailunlock( void );
void touchlock( void );
DESCRIPTION
The maillock function tries to create a lockfile for the users mailbox in an NFS-safe (or resistant) way. The algorithm is documented in
lockfile_create(3).
The mailbox is typically located in /var/mail. The name of the lockfile then becomes /var/mail/USERNAME.lock. If the environment variable
$MAIL is set, and it ends with the same username as the username passed to maillock(), then that file is taken as the mailbox to lock
instead.
There is no good way to see if a lockfile is stale. Therefore if the lockfile is older then 5 minutes, it will be removed. That is why the
touchlock function is provided: while holding the lock, it needs to be refreshed regulary (every minute or so) by calling touchlock () .
Finally the mailunlock function removes the lockfile.
RETURN VALUES
maillock returns one of the following status codes:
#define L_SUCCESS 0 /* Lockfile created */
#define L_NAMELEN 1 /* Recipient name too long (> 13 chars) */
#define L_TMPLOCK 2 /* Error creating tmp lockfile */
#define L_TMPWRITE 3 /* Can't write pid int tmp lockfile */
#define L_MAXTRYS 4 /* Failed after max. number of attempts */
#define L_ERROR 5 /* Unknown error; check errno */
NOTES
These functions are not thread safe. If you need thread safe functions, or you need to lock other mailbox (like) files that are not in the
standard location, use lockfile_create(3) instead.
These functions call lockfile_create(3) to do the work. That function might spawn a set group-id executable to do the actual locking if the
current process doesn't have enough priviliges.
There are some issues with flushing the kernels attribute cache if you are using NFS - see the lockfile_create(3) manpage.
FILES
/var/mail/user.lock,
/usr/lib/liblockfile.so.1
AUTHOR
Miquel van Smoorenburg <miquels@cistron.nl>
SEE ALSO
lockfile_create(3), lockfile_touch (3), lockfile_remove(3)
Linux Manpage 28 March 2001 MAILOCK(3)