Product SiteDocumentation Site

F.8. Running Additional Programs at Boot Time

Historically, those wishing to execute additional programs at boot could insert commands into /etc/rc.local. While systemd will use this file, writing unit files can be simple, effective, and much more flexible. Consider this example unit file:
Example F.1. An example of a simple unit file
#cat /lib/systemd/system/example.service
Description=A service that executes a user script on startup



The [Unit] section has a short description, and dependencies on other targets. The various types of dependencies and attributes used in this section are described in man systemd.unit
The [Service] section establishes the actual command to be executed, and describes how systemd should handle the process. Options for this section are described in man systemd.service.
The [Install] sets relationships with targets and similar behaviors. Options for this section are are also described in man systemd.unit