05-07-2004
Not sure if fuser will work on all flavours of UNIX.
This will loop until the file is copied. It will check every 60 seconds to see if the file is still locked and copy it when it's unlocked.
I haven't tested this
#!/bin/ksh
Status=1
while [ $Status -ne 0 ]
do
sleep 60
ProcID=`/usr/sbin/fuser filename | awk -F: '{print $2}'`
if [ "$ProcID" = "" ]
then
cp filename somewhere
fi
Status = $?
done
########################
Matt.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
I need your help.
How can I create an empty filename with a specific size, in hp-ux?
Regards,
Mizi (2 Replies)
Discussion started by: Mizi
2 Replies
2. Shell Programming and Scripting
What is the command to empty an already existing file.
please provide me.i used Touch cmd to empty the file.but it changing the time only. (4 Replies)
Discussion started by: laknar
4 Replies
3. UNIX for Dummies Questions & Answers
hi all:
my solaris FIND does not support
find myFolder -type d -empty
how can i find the empty folders?
thanks! (7 Replies)
Discussion started by: lasse
7 Replies
4. UNIX for Dummies Questions & Answers
AIX 5.3 / KSH
I have a Java application which creates a log file a.log. I have a KSH script which does the following action
cp a.log /directory2/b.log
> a.log
After this the file size goes to 0 as per "ls -l"
Then next time when the application writes into this file, the file size... (4 Replies)
Discussion started by: firdousamir
4 Replies
5. Shell Programming and Scripting
hi
how can I determine, if a file is empty or not?I am using read line clause.
The script should be like:
while read line
do
if(file is empty) then;
......
done < $blacklist (1 Reply)
Discussion started by: tjay83
1 Replies
6. UNIX for Dummies Questions & Answers
Hi All,
I am checking for a empty input file to do some further action , but I am getting exit status 0 in both the cases , for empty and non empty file both.
The value of $? is coming 0 in if part also and else part too.
#!/bin/ksh
if ]; then
echo "data"
# exit 0
echo "$?"
else... (4 Replies)
Discussion started by: mavesum
4 Replies
7. Shell Programming and Scripting
how can i use while loop ?
while file is empty do....
if not empty do .....
in bash (1 Reply)
Discussion started by: Trump
1 Replies
8. Shell Programming and Scripting
Hi All,
I have a piece of perl code in which I DON'T want to delete a file rather empty out the contents, here is the code -
if ( unlink("$opt_b") == 1 ) {
print_log( "$opt_b deleted", 1 );
}else {
print_log( "Could not delete $opt_b:$!", 1 );
... (5 Replies)
Discussion started by: jacki
5 Replies
9. Shell Programming and Scripting
Hi there,
I'm just starting out with shell scripting and I'm trying to make a test where the script will basically run yum check-update to find out if the server has any available and if it does it e-mails me but if not it will just stop there.
I have it working if there are actually... (7 Replies)
Discussion started by: Imnewtothis
7 Replies
10. Shell Programming and Scripting
The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format:
input
chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18
chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
Discussion started by: cmccabe
3 Replies
LEARN ABOUT MOJAVE
gssapi::status5.18
GSSAPI::Status(3) User Contributed Perl Documentation GSSAPI::Status(3)
NAME
GSSAPI::Status - methods for handlings GSSAPI statuses
SYNOPSIS
use GSSAPI;
$status = GSSAPI::Status->new(GSS_S_COMPLETE, 0);
if (GSS_ERROR($status->major)) {
die "a horrible death";
}
if (! $status) { # another way of writing the above
die "a horrible death";
}
$status = $some_GSSAPI->someop($args1, etc);
if ($status) {
foreach ($status->generic_message, $status->specific_message) {
print "GSSAPI error: $_
";
}
die "help me";
}
DESCRIPTION
"GSSAPI::Status" objects are returned by most other GSSAPI operations. Such statuses consist of a GSSAPI generic code and, for most
operations, a mechanism specific code. These numeric codes can be accessed via the methods "major" and "minor". The standard textual
messages that go with the current status can be obtained via the "generic_message" and "specific_message" methods. Each of these returns a
list of text which should presumably be displayed in order.
The generic code part of a GSSAPI::Status is composed of three subfields that can be accessed with the "GSS_CALLING_ERROR",
"GSS_ROUTINE_ERROR", and "GSS_SUPPLEMENTARY_INFO" functions. The returned values can be compared against the constants whose names start
with "GSS_S_" if your code wants to handle particular errors itself. The "GSS_ERROR" function returns true if and only if the given
generic code contains neither a calling error nor a routine error.
When evaluated in a boolean context, a "GSSAPI::Status" object will be true if and only if the major status code is "GSS_S_COMPLETE".
When evaluated in a string contect, a "GSSAPI::Status" object will return the generic and specific messages all joined together with
newlines. This may or may not make "die $status" work usefully.
BUGS
The base objects are currently implmented as a blessed C structure containing the major and minor status codes. It should probably be a
blessed array or hash instead, thereby cutting down on the amount of C code involved and making it more flexible.
AUTHOR
Philip Guenther <pguen@cpan.org>
SEE ALSO
perl(1) RFC2743
perl v5.18.2 2008-02-02 GSSAPI::Status(3)