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 have a Linux machine that I want to leave unattended. I have a program on this machine that I want to automatically start when the machine boots up and runs unattended.

What is the best way to configure this program to start on startup? I don't have any sort of GUI installed, so can't use gnome-session-properties or anything along that sort of line. Do I have to configure an automatic login to a special autonomous user? If the program can run without having first logged in as a user, what memory can it write to and where can it store text files it needs?

share|improve this question
it would really help to mention which distro you're using. Assuming we start this up with an init script, there are 3 different systems in use today, and the answer will need to take into account of that. – Journeyman Geek Sep 21 '12 at 15:02
@JourneymanGeek do you happen to have a link describing the differences between the three and by which distro they are used? – Baarn Sep 21 '12 at 15:04
offhand, no. init.d is the 'old' system. Upstart and startd and alternatives used by ubuntu and fedora respectively. I think the latter can run init scripts, but its very hard to answer without knowing. – Journeyman Geek Sep 21 '12 at 15:07
Sorry. Using Fedora. – Froskoy Sep 21 '12 at 15:25
@JourneymanGeek surely you meant systemd? In which case I'd advise looking at the archwiki systemd page here… – Rob Sep 21 '12 at 16:22

For systemd (which is what fedora uses), the archwiki provides a solution like this:

Create a new file in /etc/systemd/system (e.g. myscript.service) and add the following contents:

Description=My script




# systemctl enable myscript.service

This example assumes you want your script to start up when the target multi-user is launched.

share|improve this answer
Thanks. Since this process isn't then associated with a user, where can it write/read text files? – Froskoy Sep 21 '12 at 17:43
It will be run as superuser if I'm not mistaken. You can have it run as a user by setting uid for it properly I think. That's something you'd have to look up as I've never done it. – Rob Sep 23 '12 at 20:19

You must log in to answer this question.

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