2
  1. create a file
  2. change its permissions at a specific time
  3. change the permission.

At the moment this is what I have and it changes the permissions of the file but not according to the time specified.

#!/bin/bash 
$ at 13:05 
chmod 777 bin/permission.sh
1
  • 2
    1. Please break your description into sentences. 2. Please post your first attempt at writing this script. 3. Please include any problems you're having.
    – S.Lott
    Apr 6, 2011 at 21:58

2 Answers 2

3

If you want to make a file executable at 3pm, you can do:

echo chmod 777 /path/to/file | at 3pm

The at command takes a script on its standard input. So you echo the command you want to run into at and tell at when to run it.

1

You can use crontab

crontab -e

And write:

05 13 * * * chmod 0777 /full/path/to/bin/permission.sh

supposing you want it to be executed everyday at 13:05. Finally, save the file.

NOTE: The default editor seems to be "vi", if you are not comfortable with this you can change it before executing "crontab -e" with:

export EDITOR=nano

for example.

2
  • Heh, I highly doubt that emacs will be easier to use than vim. Maybe nano would be a better choice?
    – Wuffers
    Apr 7, 2011 at 21:32
  • I agree, edited now.
    – kmels
    Apr 7, 2011 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .