2

What is the command line in bash to make a program run every time the system boots up?

0

3 Answers 3

5

Add an entry to your crontab to run @reboot:

@reboot command-to-run

Use crontab -e to edit your crontab.

From man 5 crontab:

Instead of the first five fields, one of eight special strings may appear:

         string         meaning
          ------         -------
          @reboot        Run once, at startup.
          @yearly        Run once a year, "0 0 1 1 *".
          @annually      (same as @yearly)
          @monthly       Run once a month, "0 0 1 * *".
          @weekly        Run once a week, "0 0 * * 0".
          @daily         Run once a day, "0 0 * * *".
          @midnight      (same as @daily)
          @hourly        Run once an hour, "0 * * * *".
1

Look at the /etc/rc*.d folders; they are used specifically for this type of thing.

0

I don't know about command line but, through the menu, you can go to "Session" under preferences and there you can specify the command-line commands that you would normally run manually.

This process won't work if what you try to run needs administrative privileges and, AFAIK, running apps with admin privileges on startup ain't precisely easy...