Sponsored Content
Top Forums Shell Programming and Scripting Sign on/Sign off logging script Post 302096951 by Andrek on Monday 20th of November 2006 08:41:47 PM
Old 11-20-2006
I guess the easiset way is to create a "lock file"

ie
The first thing you do is check to see if a "lockfile" exist, if not, then it must be the first time and you touch a filesomewhere.....ie create the lockfile

continue process the rest of the script

The last thing the script does before it ends is remove the lock file.

That way if it starts up again....it won't do any thing...because the previous execution created a lock file and is still open at that time....

does that make sense?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Meaning of % sign

Does % sign have any impact, special meaning in unix shell scripts ??? (2 Replies)
Discussion started by: sokash
2 Replies

2. UNIX for Dummies Questions & Answers

(+ sign) Unexpected arithmetic expr script interpretation

I have created the following script to add 2 numbers together : lazyadd2 script : #!/bin/bash #I have added the she-bang script above as I felt that this would be a good idea. #The script takes in 2 arguments that are added together num3=`expr $num1 + $num2` echo $num3 I make the... (9 Replies)
Discussion started by: Birdi6022
9 Replies

3. UNIX for Dummies Questions & Answers

minus sign

why a minus sign is put for options in unix commands suggestions plz (2 Replies)
Discussion started by: trichyselva
2 Replies

4. UNIX for Dummies Questions & Answers

@ sign in permissions?

I am using Mac OS X version 10.5.7, and had a problem accessing a folder on our shared area network. I logged in via terminal (bash shell), and did a ls -l on the main directory, and the directory that isn't showing up has an @ sign at the end: rwxr-xr-x@ 19 admin staff 2048 Jun 1 07:53... (1 Reply)
Discussion started by: aaronstella
1 Replies

5. Shell Programming and Scripting

Count value between | sign

Hi I have a file inw which values are seperated by "|" I want to count number of values present in each line of the file Input file AS|23 34|BD|A2|890 AK|23 44|D|A2|89076|89 AF|23 34|BD|A2|8 Result 5 6 5 there are 5 values inside | sign hence o/p will be 5 similarly in... (2 Replies)
Discussion started by: aaysa123
2 Replies

6. Shell Programming and Scripting

Using grep $ sign help?

hi so I was debugging some scripts and I ran into a problem that did not come up before grep -n "$variable"$ ./file.txt I figured the second $ is meant to reference the end of the line but this gave me trouble in my c shell. anyone know whats wrong here or how to rewrite this??? Thank... (2 Replies)
Discussion started by: vas28r13
2 Replies

7. Shell Programming and Scripting

SSH Script is sticking, & sign not doing what I would expect

I am having an issue where I am do an SSH to about 30 servers one at a time however my script is getting hung up sometimes on the SSH. I thought the & at the end as seen below would fire it and move on but that does not seem to be working. #!/bin/s for remsys in trumpetsnail angel delphin... (3 Replies)
Discussion started by: LRoberts
3 Replies

8. Shell Programming and Scripting

Script to replace last instance of . between two consecutive = sign by ,

Suppose you have a line like this: cn=user.blr.ou=blr.india.o=company The line should be converted like this: cn=user.blr,ou=blr.india,o=comapny Was wondering how to do that using shell script. Please use tags where appropriate, thank you (4 Replies)
Discussion started by: saurabhkoar
4 Replies

9. Forum Support Area for Unregistered Users & Account Problems

Unable to sign in

I am unable to sign in to the UNIX forum. I tried my username "timotei2" and the password - but access was denied. My email address - <removed> - was not recognised, either. This is strange as I registered some years back. Should I re-register, or can nyou re-set my log in credentials? (1 Reply)
Discussion started by: Unregistered
1 Replies

10. Forum Support Area for Unregistered Users & Account Problems

Sign in issues

I tried logging in under my username (Michael Mullig) but as it's been a while I've forgotten my password. None of my email addresses are recognized either. Thinking that my username my have been purged due to lack of activity (understandable) I tried to re-register, only to find the name is still... (2 Replies)
Discussion started by: Mike Mullig
2 Replies
maillock(3MAIL) 					  User Mailbox Library Functions					   maillock(3MAIL)

NAME
maillock, mailunlock, touchlock - functions to manage lockfile(s) for user's mailbox SYNOPSIS
cc [ flag ... ] file ... -lmail [ library ... ] #include <maillock.h> int maillock(const char *user, int retrycnt); void mailunlock(void); void touchlock(void); DESCRIPTION
The maillock() function attempts to create a lockfile for the user's mailfile. If a lockfile already exists, and it has not been modified in the last 5 minutes, maillock() will remove the lockfile and set its own lockfile. It is crucial that programs locking mail files refresh their locks at least every three minutes to maintain the lock. Refresh the lockfile by calling the touchlock() function with no arguments. The algorithm used to determine the age of the lockfile takes into account clock drift between machines using a network file system. A zero is written into the lockfile so that the lock will be respected by systems running the standard version of System V. If the lockfile has been modified in the last 5 minutes the process will sleep until the lock is available. The sleep algorithm is to sleep for 5 seconds times the attempt number. That is, the first sleep will be for 5 seconds, the next sleep will be for 10 seconds, etc. until the number of attempts reaches retrycnt. When the lockfile is no longer needed, it should be removed by calling mailunlock(). The user argument is the login name of the user for whose mailbox the lockfile will be created. maillock() assumes that user's mailfiles are in the ``standard'' place as defined in <maillock.h>. RETURN VALUES
Upon successful completion, .maillock() returns 0. Otherwise it returns -1. FILES
/var/mail/* user mailbox files /var/mail/*.lock user mailbox lockfiles ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
libmail(3LIB),attributes(5) NOTES
The mailunlock() function will only remove the lockfile created from the most previous call to maillock(). Calling maillock() for different users without intervening calls to mailunlock() will cause the initially created lockfile(s) to remain, potentially blocking subsequent message delivery until the current process finally terminates. SunOS 5.10 29 Mar 1999 maillock(3MAIL)
All times are GMT -4. The time now is 02:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy