I need your help for UNIX Shell scripting, I need to prepare and execute script by unix crontab to check for file's and directoires permissions and change the permissions if necessary.
under /u01/ram/ there are number of file, in which few file are .txt extension files, like as below.
normally, those *.txt should always have 700 permission, but sometime by some user who is part of dba group, by mistake change file perssion like anything 755 or 777 etc.
my need is, under /u01/ram/ folder if *.txt file permission get change then
shell script should perform below action
----------------------------------------
give output like what are the files got change (which is not 700 permission)
then
change the file permission as 700 for thsoe file which have wrong permission.
and then send output by mail for those file with the current file permission.
appreciate your help..
Regards,
Last edited by vbe; 06-22-2016 at 05:22 AM..
Reason: code tags please
You did not reply to my previous post ( #7 )...
Before wrting a cron job to change those files, you must know what they are and how import tant they are ( content) as we just ses files with txt extension...
What about your cron does change the perms, only the files are not the same, how are you going to trace? certainly will it be too late as cron did what you wanted adn the time you find you are in trouble you have no more logs to look at..
Reply to post 7 first so we can suggest an adequate solution
Hi,
this is the structure of the directory
/local/home/app/cases
under cases directory, below are the sub directories and each directory has files.
/local/home/app/cases/1
/local/home/app/cases/2
/local/home/app/cases/3
/local/home/app/cases/4
File types are .txt .sh and so... (5 Replies)
Hello all, I am trying to create a script or a .command file that will run for me and my other techs on many, many Mac OSX computers that will add a file to the /etc/ folder called /etc/launchd.conf
Every time I try to run the script, I get "Permission Denied" when trying to put the file into... (13 Replies)
I want to change the permission of a dir to 777 after every hour in a background process.I do not have the access to the crontab , is there another way of doing it a scrit of some thing like that . Any help will be great. (1 Reply)
Guys, I need help.
I need to change the .txt file permission after I have reset the file content to 0.
The code that reset the file content to 0 is as follows:
#!/bin/sh
for i in /root/script/*.txt
do
echo "0" > $i
done
However, the file is generated by the apache application,... (3 Replies)
Hi Guys,
I want to know is there any method to create a file having 777 permission. I am aware of umask, since it is only giving max. 666 permission for files this is not fulfilling my needs.
Thanks in advance
---------- Post updated at 12:49 AM ---------- Previous update was at 12:31... (10 Replies)
Hello,
I would to create a new user with some restriction:
1. The user will not be able to CD any directory (I mean he'll login to the defined home directory and that's all).
2. The user will not be able to delete anything in that home directory
Thanks a lot in advance,
Shahar (1 Reply)
In my script, I am creating a file ----> then writting one line (i.e. Timestamp) ----> then FTP'ing. The same script can be executed by many other users.
While other users executing this script, they couldn't Over write this one line (i.e. Timestamp)
My expectation
So I wanted to create a... (2 Replies)
I am creating a file using the UTL_FILE command of oracle. This creates a file with the oracle user id. The file does not have permission for being read by any other user id. Is there a way that I can change this default permission. I tried using umask in the .login. Setting the umask to 022 works... (2 Replies)
Hi!! Experts,
Is there any way to find the timestamp when the permission of a file was modified?? I mean no change to file contents.. Just the chnage of permissions.
:) (1 Reply)