Wiki‎ > ‎

Startup scipt for ubuntu

posted Aug 2, 2016, 5:16 PM by Danny Xu   [ updated Aug 2, 2016, 5:18 PM ]
1. simple, requires root
vi /etc/rc.local

2. upstart system

A simple command (one which doesn't need to remain running) could use an Upstart job like:

start on startup
exec /path/to/command

Save this in a .conf file in /etc/init (if you need it to run as root when the system boots up), or in ~/.config/upstart (if you need it to run as your user when you log in).

3. crontab, requires root

  1. Running crontab -e will allow you to edit your cron.
  2. Adding a line like this to it:

    @reboot /path/to/script

    will execute that script once your computer boots up.

The @reboot keyword is a nice tip because it is not widely known.
@reboot is executed on startup (when cron daemon is started). So far this seems better than rc.local since the system seems more setup
by this point (PATH, etc).
It is odd that it is so hard to call something after system startup.