Professional Web Applications Themes

Making Files Readonly With a script - Linux Setup, Configuration & Administration

On Tue, 26 Aug 2003 21:50:02 +0100, JRH <john.nntpyoredale2003.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 ...

  1. #1

    Default Re: Making Files Readonly With a script

    On Tue, 26 Aug 2003 21:50:02 +0100, JRH <john.nntpyoredale2003.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

  2. #2

    Default Re: Making Files Readonly With a script

    > 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 {} \;
    I'd add a -type f, or directories will be left inaccessible.

    Eric
    Eric Moors Guest

Similar Threads

  1. Script Error after making changes
    By txnovice in forum Macromedia Contribute Connection Administrtion
    Replies: 0
    Last Post: June 26th, 11:54 AM
  2. PDF-making Script
    By woopit@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 15
    Last Post: October 9th, 03:10 PM
  3. Files not showing readonly or checked out
    By tshad in forum Dreamweaver AppDev
    Replies: 0
    Last Post: May 10th, 03:08 AM
  4. Files become ReadOnly
    By Miro in forum ASP.NET Security
    Replies: 1
    Last Post: May 18th, 12:11 AM
  5. making pdf files from prn files - fonts error
    By ruda@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 4
    Last Post: May 6th, 07:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139