I want to run a script as root when the computer starts. This was earlier done in rc.local, but not anymore.

What I've tried:

  • putting the script in /etc/profile.d
  • adding the /pathto/script.sh in /etc/profile
  • added /pathto/script.sh & in /etc/xdg/openbox/autostart

The script is for setting things powertop recommends; the script works just fine when I run sudo /pathto/script.sh.

  • FYI, anything in /etc/profile* is run when a user (and any and every user) logs in, not when the system boots. – depquid May 7 '13 at 15:59
  • Ok sure, I then assume that they are run as the user who log in. Sooo where is the file that root runs? – Gunnish May 7 '13 at 16:19
  • 1
    /etc/rc.local would be the right place. Why not keep it there? Why involve Openbox, which is not started when the computer starts but only if someone logs in and chooses that as their window manager? – Gilles 'SO- stop being evil' May 7 '13 at 23:06
  • Why not? Because it is not used anymore in arch. – Gunnish May 8 '13 at 8:40

You could put it in your crontab with

@reboot /pathto/script.sh
  • Yes, this seems to be a viable way to do it. Why didn't i think about cron? – Gunnish May 9 '13 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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