Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URGENT Permissions issue 1

Status
Not open for further replies.

theniteowl

Programmer
May 24, 2005
1,975
US
We have a java script that generates files in a folder on our Linux server that need to be picked up by a process on another server but the files are being written with RW only permissions and we need them written with RW-R--R--

The folder is setup to default to the RW-R--R-- permissions when new files are created but somehow the Java app is setting it differently.

Until I can figure this out can someone show me how to setup a simple script to periodically execute the command CHMOD 644 /ops/acct/*.JRF?
Every 10 - 20 minutes should be sufficient but my Linux skills are still fairly basic.

This is an automated process that needs to occur relatively quickly but we cannot sit and monitor the folder all night long to keep modifying the files.

Any help would be appreciated.

At my age I still learn something new every day, but I forget two others.
 
crontab -e (sudo if not root)


cron table entry

/10 * * * * [command line goes here]

use tab to separate the parameters.



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
Thanks Chris.

I had managed an overnight work around by setting my putty session to keep-alive and using the following code to keep changing the file permissions on those files.
watch -n 30 chmod -f 644 "*.JRF" || true

I had to force the return code true otherwise when the other server picked up the existing files and there were none left in the folder the chmod command would throw an error and cause the watch command to stop working.
Now I have to figure out why these files are not generating with the correct permissions from the java app.

Thanks.

At my age I still learn something new every day, but I forget two others.
 
Go to the [tt].profile[/tt] or [tt].bashrc[/tt] file for the userid that the Java process runs in and put the following command in it. Or, if the java process is started with a shell script, put it somewhere before the "java" command in the script.

Code:
uname 0

This will cause any files the process creates to be created with [tt]wr-wr-wr-[/tt] file permissions.

Whatever you do, don't set up a [tt]cron[/tt] job to [tt]chmod[/tt] it. That's addressing the symptom, not the cause.

 
SamBones,
you must've thought of
[tt]umask 0[/tt]
I would propose:
[tt]umask 002[/tt]
 
Yeah, it depends on how open he wants to be with the files. I assumed once he had the correct command he would investigate what the value meant and adjust it to his needs.

 
Thanks guys.
I never did find out where the permission was being set in the app but did add the umask 022 to the beginning of the shell script that runs the java app and that cleared up the problem.
This is probably a better method anyway.

There are a few issues with file permissions that will need to be cleared up but there have been a number of changes in the way permissions all over the server are handled so it will take some testing to ensure everything remains working.


At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top