Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am in the middle of create a local FTP server and I need this script to run when the machine boots up:

while [ 1 ];
chmod 2777 /home/ftp/folder;
chmod -R 777 /home/ftp/folder;
sleep 60;

Which is the best way to go about this?

I have tried to put it in the rc.local file but this doesn't allow the server to boot properly at all, also this script needs to be ran as sudo, if that will make a difference within the the script is ran.

Any help or ideas would be appreciated, Thanks.

share|improve this question

migrated from Jun 7 '13 at 13:48

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

Are you sure about the "chmod -R 777".. this makes all files executable too. I'm paranoid, I don't want some description of "hey don't do: rm -rf /" turned into a script by being executable :) – Rich Homolka Jun 7 '13 at 15:59
I understand that but for what I'm creating it needs to be executable. The server can only be accessed internally and each account is assigned to individuals. – Ash King Jun 10 '13 at 11:28
up vote 1 down vote accepted

whats about using a cronjob?


chmod 2777 /home/ftp/folder
chmod -R 777 /home/ftp/folder

into a script file and invoke it every minute:

sudo crontab -e

and invoke with following:

* * * * * /path/to/

further information - ubuntu wiki

share|improve this answer
Thanks, worked perfect! – Ash King Jun 7 '13 at 12:33
  • Remove the loop from your script
  • Place the script into some reasonable directory (e.g. /usr/local/sbin/)
  • Place a cron job description into /etc/cron.d/ , e.g.

* * * * * myuser /usr/local/sbin/myscript

This will make your script run every minute. Then, to be completely on the safe side, you'd need to add some way to ensure that only once instance is running (i.e. to not run if another instance takes more than a minute to finish). This is usually done via lock files.

share|improve this answer

You must log in to answer this question.

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