export file permissions
Brian K. White
brian at aljex.com
Thu Jun 17 11:44:41 PDT 2010
On 6/17/2010 11:54 AM, Kroboth, Joe wrote:
> I created a json export processing table. I'm using the 'create' command to create the new export file. How do I get filePro to set/change the permissions on the newly created file? The default seems to set 0600. Using Linux with filePro 5.6.07.
>
> Thanks for your time.
>
Create the file before calling the clerk/report command, or with a
system command in processing before calling open(), and don't use
create() (or the c option to open() which will create on the fly).
umask 0
export T=/tmp/out.txt
rm -f $T
touch $T
rreport ...
Then fh = open(getenv("T"),"wt")
Then: fn="/tmp/out.txt"
Then: system noredraw "umask 0;rm -f "<fn<";touch"<fn
Then: fh=open(fn,"wt")
if the filename is really good and garanteed to be unique you can skip
the rm, and touch and shorten it to just:
umask 0
export T=/tmp/${0##*/}_${$}_${RANDOM}.txt
>$T
rreport ...
Then fh = open(getenv("T"),"wt")
[...]
Then: x = close(fh)
(file is left behind, presuming the shell script needs to do something
with it now after rreport exits, shell script needs to remove it when
done to avoid future collisions)
or
Then: fn="/tmp/"{@fi{@rn{@id{rand(){".txt"
Then: system noredraw "umask 0;>"{fn
Then: fh=open(fn,"wt")
[...]
Then: x = close(fh) ; x = remove(fn)
@once: :Then: x = rand("-1") ; end
(assuming you created and used the file all within processing, thus the
remove() )
The point about the different create and remove options is the proper
way to create the file depends on what you need to do with it, which you
have not disclosed. Also, "umask 0" is possibly unnecessarily
permissive. Again, because I don't know what you actually need to do
with the file. umask 0 ensures anything and anyone anywhere can do
anything to the file, as long as filepro has closed (released it's write
lock) on it, which I have included in the example code.
--
bkw
More information about the Filepro-list
mailing list