Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Ang: Re: Unisx question
Well doesthat answer reply to the question: I have for instance this script
/konto/load.sh
that line is included in the main unix script and I want it to be logged if that script( load.sh ) doesnt start at all.
which is includedin the main unix
Thanks
Roland
Steven Lembark <lembark_at_wrkhors.com>@fatcity.com den 2002-01-26 23:40 PST
Sänd svar till ORACLE-L_at_fatcity.com
Sänt av: root_at_fatcity.com
Till: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> Kopia:
> Hallo,
>
> Can anyone give me a good script on how to create a logfile in unix
> directory if a file(a script) in this script is not executed?
Not a very clear question. If you need to check whether something completes then have the code write out a pidfile when it starts and unlink it on the way out. A second process can check for the pidfile at a later time; if the file is present then check for the process still running. If the process croaks before the unlink you will find a pidfile that contains a non-running process [leaving out the rather unlikely case that your pid's wrap].
e.g.,
#!/usr/bin/perl
my $pidfile = $rundir . '/' . basename $0;
open my $pidfh, '>', $pidfile
or croak "$pidfile: $!";
print $pidfh "$$\n";
close $pidfh;
# do things...
unlink $pidfile
or croak "unlink $pidfile: $!";
-
__END__ A second process can then look for the pidfile (e.g., /var/run/blah.pid), open it and scream for help if the file is present and the pid doesn't refer to a running process.
You are nearly always better off having the process that ran whatever the sql is checking for itself, however, since any external method runs into various logic races rather quickly.
enjoi.
-- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582 -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Steven Lembark INET: lembark_at_wrkhors.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Roland.Skoldblom_at_ica.se Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Sun Jan 27 2002 - 02:29:22 CST
![]() |
![]() |