comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » close journal file read-only
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
close journal file read-only [message #79034] Mon, 23 January 2012 12:57 Go to next message
Bringfried Stecklum is currently offline  Bringfried Stecklum
Messages: 75
Registered: January 1996
Member
I guess many of us log their IDL session to keep track of the work. My question
is whether it is possible to close the log file and make it read-only from
within IDL? The journal command lacks a corresponding option. I just want to
avoid that the file is being deleted/changed later on by accident.

If this cannot be done by IDL itself, I have to come up with a cronjob that
checks the log folder for closed files which are still writable, and changes
their attribute.

Regards, Bringfried
Re: close journal file read-only [message #79112 is a reply to message #79034] Thu, 02 February 2012 07:55 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Heinz Stege writes:

> My experience with an exit-replacement was, that it is hard to change
> one's habit of typing "exit" to finish the session. I bet, you will
> type "exit" instead of "myexit" several times...

Yes, the Useability Index score might go up if you
just choose a good filename to begin with:

Journal, 'j'+ timestamp() + '.log'

Then you could batch process all your log files to
read-only status any time you thought it might be
a good idea.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: close journal file read-only [message #79114 is a reply to message #79034] Thu, 02 February 2012 07:27 Go to previous messageGo to next message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
Hi Bringfried.

On Thu, 02 Feb 2012 10:05:13 +0100, Bringfried Stecklum wrote:

> maybe I didn't get your question. Simply type "myexit" at the IDL prompt instead
> of "exit", and the session will close.
>
Okay, my failure. My hope was that you had found a method to register
(or something like that) your routine within the IDL startup file. So
that IDL executes your routine at the usual exit command.

My experience with an exit-replacement was, that it is hard to change
one's habit of typing "exit" to finish the session. I bet, you will
type "exit" instead of "myexit" several times...

Heinz
Re: close journal file read-only [message #79122 is a reply to message #79034] Thu, 02 February 2012 01:05 Go to previous messageGo to next message
Bringfried Stecklum is currently offline  Bringfried Stecklum
Messages: 75
Registered: January 1996
Member
Heinz Stege wrote:
> Hi Bringfried,
>
> Thank you for answering your own question. :-)
>
> Now I have to ask something: How do you make IDL to start the
> procedure myexit before IDL exits?
>
> Heinz
Hi Heinz,

maybe I didn't get your question. Simply type "myexit" at the IDL prompt instead
of "exit", and the session will close.

Regards, Bringfried
Re: close journal file read-only [message #79129 is a reply to message #79034] Wed, 01 February 2012 06:46 Go to previous messageGo to next message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
Hi Bringfried,

Thank you for answering your own question. :-)

Now I have to ask something: How do you make IDL to start the
procedure myexit before IDL exits?

Heinz
Re: close journal file read-only [message #79130 is a reply to message #79034] Wed, 01 February 2012 05:20 Go to previous messageGo to next message
bstecklu is currently offline  bstecklu
Messages: 14
Registered: February 2012
Junior Member
On Jan 23, 9:57 pm, Bringfried Stecklum <steck...@tls-tautenburg.de>
wrote:
> I guess many of us log their IDL session to keep track of the work. My question
> is whether it is possible to close the log file and make itread-onlyfrom
> within IDL? Thejournalcommand lacks a corresponding option. I just want to
> avoid that the file is being deleted/changed later on by accident.
>
> If this cannot be done by IDL itself, I have to come up with a cronjob that
> checks the log folder for closed files which are still writable, and changes
> their attribute.
>
> Regards, Bringfried

Well, although the interest in the question was not particularly
overwhelming,
below is my IDL exit procedure which answers the question

; close journal, make it read-only, and exit
pro myexit
; get file name for journal unit
help,/files,!journal,out=out
; omit IDL string treatment
spawn,'echo '+out[1]+"| awk '{printf $8}'",file
ans="N"
read,"Really close journal and exit? y/N ",ans
if (ans eq "y") or (ans eq "Y") then begin
journal
file_chmod,file,a_write=0
exit
end
end
Re: close journal file read-only [message #79201 is a reply to message #79112] Fri, 03 February 2012 01:04 Go to previous message
bstecklu is currently offline  bstecklu
Messages: 14
Registered: February 2012
Junior Member
David Fanning wrote:
> Heinz Stege writes:
>
>> My experience with an exit-replacement was, that it is hard to change
>> one's habit of typing "exit" to finish the session. I bet, you will
>> type "exit" instead of "myexit" several times...
>
> Yes, the Useability Index score might go up if you
> just choose a good filename to begin with:
>
> Journal, 'j'+ timestamp() + '.log'
>
> Then you could batch process all your log files to
> read-only status any time you thought it might be
> a good idea.
>
> Cheers,
>
> David
>
I am using this filename scheme anyway. I agree that changing the habit from
"exit" to "myexit" might not be that easy. Another possibility is to wrap the
IDL command with a bash script that changes the logfile to read-only after the
session was closed. This would also work if IDL crashed or was killed.

cheers, Bringfried
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ANOVA statistical analysis with IDL
Next Topic: Re: Read data as array structure

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:43:08 PDT 2025

Total time taken to generate the page: 0.00504 seconds