Ask a Question related to Linux Setup, Configuration & Administration, Design and Development.
-
Alan Connor #1
Re: Making Files Readonly With a script
On Tue, 26 Aug 2003 21:50:02 +0100, JRH <john.nntp@yoredale2003.uklinux.net> wrote:
>
>
> Brad S wrote:
>>>> My goal is to make all files in my usershare directory readonly if the
>> have not been modified within the last 14 days. I am assuming that I
>> could do this with cron, can anyone help me with the commands that I
>> would be using? I have a feeling that the find command will be used,
>> but I am still just a newbie admin.
> First create a script that does what you want...
> man find
> man chmod
> will provide the info you need to know.
> Also look at bashref.html for help on writing scripts. It is probably part
> of your distro.
>
> To run via cron, Red Hat and Mandrake (and others probably) have a
> /etc/cron.daily directory. Put your script in there. Much easier than
> messing with crontab. And that way it gets processed by anacron if the
> system is down at the time it should have run. But if you want to be more
> adventurous, try
> man cron
> man crontab
> man anacron
>
> ...John
For the cron.daily script, make sure you use full paths for EVERYTHING.
This should work:
#!/bin/bash
/usr/bin/find yourdir -mtime +14 -exec /bin/chmod 444 {} \;
exit 0
Alan C
--
take control of your mailbox ----- elrav1 ----- [url]http://tinyurl.com/l55a[/url]
Alan Connor Guest
-
Script Error after making changes
First, I am not a website designer. I own a website and have been making minor (text) changes using Contribute since I didn't need to know html. I... -
PDF-making Script
Is there a script to get pdfs made automatically? Currently, I am making pdfs by processing ad after ad by making a ps file and then dragging it into... -
Files not showing readonly or checked out
I connected to my remote folder on my web server and synchronized the local view with the remote view. this worked fine. The problem is that the... -
Files become ReadOnly
Hello For some strange reasons, some of my files become ReadOnly when I copy them to a subfolder to my ASP.NET application. For each new session I... -
making pdf files from prn files - fonts error
PLS help! Operating system - XP Adobe version - 4.05, 5 and 6... (tried them all) ever since I upgraded my operating system to XP I experience... -
Eric Moors #2
Re: Making Files Readonly With a script
> For the cron.daily script, make sure you use full paths for EVERYTHING.
I'd add a -type f, or directories will be left inaccessible.>
> This should work:
>
>
> #!/bin/bash
>
> /usr/bin/find yourdir -mtime +14 -exec /bin/chmod 444 {} \;
Eric
Eric Moors Guest



Reply With Quote

