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'm having lots of problems with my Ubuntu 10.04 in AWS and init scripts. I have my rc.local with some mounts, mkdirs & more but they don't do everything as expected, just a few of them and not always the same.

I'm learning puppet, but until I'll be prepared to get my machine remotely configured I'm trying to do something more ugly. I thought to do a cronjob every 3 minutes to configure all the system and save a flag file in my /dev/shm. When my instance get rebooted or something worse, this file will be deleted and my script will attempt to init the server again.

Do you have something more clever?

Thanks in advance!

share|improve this question
Why do you have mounts and mkdirs in rc.local scripts? What does "capture the system" mean? Please edit your question to make it more specific. What exactly are you trying to do? I get the impression you are making things much more complicated than necessary. – terdon Aug 22 '12 at 14:00

You don't need to mess with flag files – cron already does that for you. You can schedule a @reboot job which will be run exactly once every time the instance starts:

In a user crontab:

@reboot /my/script

In a system-wide /etc/crontab:

@reboot root /my/script

And of course, simply adding commands to /etc/rc.local will have the same effect, since rc.local is only run when booting (though a little later than @reboot cronjobs).

share|improve this answer
Side note: /dev/shm is the wrong location for flag files; it is used by Linux glibc shm functions. Most programs use the directories /run (FHS 3.0 d1) or /var/run (FHS 2.3) to store runtime data. – grawity Aug 22 '12 at 15:04

You must log in to answer this question.

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