02-18-2010
In case of an error let the shell script touch an empty lock file somewhere, maybe /tmp/server_status.lck for example, so it can remember on next check, what former status was. Example:
server offline and no lock file -> new status so touch lock file and send mail
server offline and lock file exists -> do nothing, just a log entry
server online and lock file exists -> delete lock file and send mail that all is ok again
server online and lock file does not exist -> do nothing, just a log entry
Easy to cover with some "if/then/fi" and "else" constructs.
9 More Discussions You Might Find Interesting
1. Solaris
Hi , we are using Veritas cluster server on solaris 8. Suddenly one application group was offline and online after 2 minutes.. I have checked VCS log..
"VCS INFO V-16-1-50135 User reuters fired command: hares -offline middleman_proc server01 from 127.0.0.1" Does anyone faced this... (0 Replies)
Discussion started by: ddk2oo5
0 Replies
2. UNIX for Advanced & Expert Users
Hi ,
How do i check that the CPU is online/offline in a multi CPU machine in Linux ?
i tired /proc/cpuinfo
dmesg
nothing gave me the currect CPU status.
Pls help !! (5 Replies)
Discussion started by: sars
5 Replies
3. UNIX for Advanced & Expert Users
We use Sun Volume manager to mirror root disks and other local disks...
Is there any script to monitor raid status across all machines send output thru email?
Help is appreciated.
Thanks. (1 Reply)
Discussion started by: sriny
1 Replies
4. Solaris
Hi all
in my server all nfs dependices are online but nfs client is offline
root@BIWAPP1 # svcs -a|grep nfs
disabled Sep_05 svc:/network/nfs/server:default
online Sep_05 svc:/network/nfs/rquota:default
online Sep_05 svc:/network/nfs/mapid:default
online ... (9 Replies)
Discussion started by: spandhan
9 Replies
5. UNIX for Advanced & Expert Users
what is the command for checking which device active and which is not active (1 Reply)
Discussion started by: RahulJoshi
1 Replies
6. UNIX for Dummies Questions & Answers
Dear all,
How to recover the Dns service from offline to online?
I used the command " svcadm enable dns/client"
the command is executing but again its showing service is offline.
pls clarify and give me suggesstion...
Thanks in advance (1 Reply)
Discussion started by: masthan25
1 Replies
7. UNIX for Advanced & Expert Users
I have two Solaris 10 T2000 systems.
Platform sun8 has newer firmware than sun7.
sun8/user$ prtdiag -v | grep OBP
OBP 4.30.4.b 2010/07/09 13:48
sun7/user$ prtdiag -v | grep OBP
OBP 4.30.4.a 2010/01/06 14:56
The platform (sun8) with the newer firmware (OBP 4.30.4.b) has a Fault... (2 Replies)
Discussion started by: DavidHalko
2 Replies
8. Shell Programming and Scripting
:wall:Hi,
I am not sure whether i can post this question in this forum or not. because it is not completely releated to unix, but also oracle.
My question is,
How can we know the instance name(particularly the last number, eg., in INST_DB12, i need 12) when it is OFFLINE(i.e., down)... (1 Reply)
Discussion started by: Dpu
1 Replies
9. Shell Programming and Scripting
Hi ,
Is there any script to copy a files (weblogic bianary + silent.xml ) from one server (linux) to another servers and then execute the copy file.
We want to copy a file on multiple servers and run the installation.
Thanks (1 Reply)
Discussion started by: Nawrajesh
1 Replies
SHLOCK(1) General Commands Manual SHLOCK(1)
NAME
shlock - create lock files for use in shell scripts
SYNOPSIS
shlock -p pid -f name [ -b ] [ -u ] [ -c ]
DESCRIPTION
Shlock tries to create a lock file named name and write the process ID pid into it. If the file already exists, shlock will read the
process ID from the file and test to see if the process is currently running. If the process exists, then the file will not be created.
Shlock exits with a zero status if it was able to create the lock file, or non-zero if the file refers to currently-active process.
OPTIONS
-b Process IDs are normally read and written in ASCII. If the ``-b'' flag is used, then they will be written as a binary int. For
compatibility with other systems, the ``-u'' flag is accepted as a synonym for ``-b'' since binary locks are used by many UUCP pack-
ages.
-c If the ``-c'' flag is used, then shlock will not create a lock file, but will instead use the file to see if the lock is held by
another program. If the lock is valid, the program will exit with a non-zero status; if the lock is not valid (i.e., invoking
shlock without the flag would have succeeded), then the program will exit with a zero status.
EXAMPLES
The following example shows how shlock would be used within a shell script:
LOCK=/var/run/innd/LOCK.send
trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
if shlock -p $$ -f ${LOCK} ; then
# Do appropriate work
else
echo Locked by `cat ${LOCK}`
fi
HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> after a description of HDB UUCP locking given by Peter Honeyman. This is revision 1.9, dated
1996/10/29.
SHLOCK(1)