Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
  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
share|improve this question
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 '11 at 21:58
add comment

migrated from stackoverflow.com Apr 7 '11 at 4:26

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 3 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
    
Heh, I highly doubt that emacs will be easier to use than vim. Maybe nano would be a better choice? –  Wuffers Apr 7 '11 at 21:32
    
I agree, edited now. –  kmels Apr 7 '11 at 22:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.