File: prontolock

package info (click to toggle)
pronto 2.4.0-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,112 kB
  • ctags: 487
  • sloc: perl: 22,159; makefile: 127; sh: 34; sql: 7
file content (34 lines) | stat: -rwxr-xr-x 816 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl
# $Id: prontolock,v 1.2 2001/05/28 00:37:25 muhri Exp $
#This script will lock in /var/spool/mail so that freaking sendmail respects it
#and doesn't append anything to the spoolfile while Pronto is reading it - it
#was a pain to find out that sendmail doesn't respect flock() therefore this 
#script has to be installed setgid just like movemail, however at least its 
#our code.
#Maher <muhri@muhri.net>


$action = $ARGV[0];
$path = $ARGV[1];

if (!$action) { 
	print("This is a script to lock/unlock the mail spool file\n
		for use with Pronto, You shouldn't be running it.\n");

}

if ($action eq "lock") {

	$tmp=">$path.lock";
	if ($tmp=~/(.*)/){$tmp=$1;}
	open LOCK, $tmp or die $!;

}

if ($action eq "unlock") {

	$tmp="$path.lock";
 	if ($tmp=~/(.*)/){$tmp=$1;}
 	unlink $tmp or die $!;

}