Difference between revisions of "Autostarting"

From ArchWiki
Jump to: navigation, search
m (Fixed headers)
(change Boot process category to System administration as it's more fitting)
 
(86 intermediate revisions by 26 users not shown)
Line 1: Line 1:
[[Category:Boot process]]
+
[[Category:System administration]]
 
[[es:Autostarting]]
 
[[es:Autostarting]]
This article links to various methods to launch scripts or applications automatically when some particular event is taking place, like system startup or shutdown, shell login or logout and so on.
+
[[ja:自動起動]]
 +
[[ru:Autostarting]]
 +
[[zh-hans:Autostarting]]
 +
{{Related articles start}}
 +
{{Related|Daemons}}
 +
{{Related articles end}}
  
== Daemons ==
+
This article links to various methods to launch scripts or applications automatically when some particular event is taking place.
You can easily start your scripts or applications as daemons, see [[Daemon]] and [[Writing rc.d scripts]].
 
  
=== Systemd ===
+
== On bootup / shutdown ==
''systemd'' is the default init framework, replacing initscripts. The services which are started by ''systemd'' can be found in the subfolders of {{ic|/etc/systemd/system/}}. Services can be enabled using the {{ic|systemctl}} command. For more information about ''systemd'' and how to write autostart scripts for it, see at [[systemd]].
 
  
=== Legacy Init Chain ===
+
Use [[systemd]] services.
{{ic|/etc/rc.local}} and {{ic|/etc/rc.local.shutdown}} are where the traditional init framework would read from for user generated startup actions. You can write rc.local as a shell script that will be run every boot under the legacy initscripts framework.
 
  
=== Runit ===
+
== On user login / logout ==
''runit'' is a mature init system which offers process supervision, parallel startup, per-user service trees, granular cgroup manipulation, flexible dependency system, and boot times that don't incur the penalty of dbus. The root-level services are symlinks in {{ic|/service}} with the actual service directories in {{ic|/etc/sv}}. See the [[Runit]] page for more information.
 
  
== Shells ==
+
Use [[systemd/User]] services.
  
To autostart programs in console you can use shell startup files/directories. Read the documentation for your shell, or its ArchWiki article, e.g. [[Bash]] or [[Zsh]].
+
== On time events ==
  
=== /etc/profile ===
+
Periodically at certain times, dates or intervals:
  
{{ic|/etc/profile}} is sourced by all Bourne-compatible shells upon login: it sets up an environment upon login and application-specific ({{ic|/etc/profile.d/*.sh}}) settings.
+
* [[systemd/Timers]]
 +
* [[Cron]]
  
Each time {{ic|/etc/profile}} is executed, it sources the following scripts if they exist:
+
Once at a date and time:
* {{ic|/etc/profile.d/*.sh}}
 
* {{ic|/etc/bash.bashrc}} (if shell is bash)
 
* {{ic|/etc/bash_completion}}
 
  
===See also===
+
* [[systemd/Timers]]
*{{ic|INVOCATION}} section of {{ic|man bash}}
+
* {{Pkg|at}}
*{{ic|STARTUP/SHUTDOWN FILES}} section of {{ic|man zsh}}
 
*[[Wikipedia:Unix_shell#Configuration files for shells]]
 
  
== Graphical ==
+
== On filesystem events ==
You can autostart programs automatically when you login into your [[Window Manager]] or [[Desktop Environment]].
 
  
=== X session startup ===
+
Use an [[Wikipedia:inotify|inotify]] event watcher:
  
See [[xinitrc]] and [[xprofile]].
+
* {{Pkg|inotify-tools}} (see [https://techarena51.com/index.php/inotify-tools-example/ some examples])
 +
* [[Incron]]
 +
* {{AUR|fswatch}}
  
=== X Desktop Group ===
+
== On shell login / logout ==
  
{{ic|$XDG_CONFIG_DIRS/autostart/}}: In this folder are {{ic|.desktop}} files. These files determine which programs are loaded for which desktop environment. For an explanation of the desktop file standard refer to [http://standards.freedesktop.org/desktop-entry-spec/latest/ Desktop Entry Specification].
+
See [[Command-line shell#Configuration files]].
  
=== GNOME, KDE, Xfce ===
+
== On Xorg startup ==
  
[[GNOME]], [[KDE]] and [[Xfce]] all have a dedicated GUI for autostart settings, see the respective articles.
+
* [[xinitrc]] if you are starting [[Xorg]] manually with [[xinit]].
 +
* [[xprofile]] if you are using a [[display manager]].
  
You can also directly put [[Creating desktop entries and menus|.desktop]] files in {{ic|~/.config/autostart/}}
+
== On desktop environment startup ==
  
==== KDE (Legacy) ====
+
If the [[desktop environment]] has an ArchWiki article, see its ''Autostart'' section.
  
KDE also has a specific folder: {{ic|~/.kde/Autostart}} or {{ic|~/.kde4/Autostart}}
+
* [[GNOME#Autostart]]
 +
* [[KDE#Autostart]]
 +
* [[Xfce#Autostart]]
 +
* [[LXDE#Autostart]]
 +
* [[LXQt#Autostart]]
  
=== LXDE ===
+
Most desktop environments implement [[XDG Autostart]].
  
See [[LXDE#Autostart_Programs]].
+
== On window manager startup ==
  
=== Fluxbox ===
+
If the [[window manager]] has an ArchWiki article, see its ''Autostart'' section.
  
See [[Fluxbox#Autostarting Applications]].
+
* [[Fluxbox#Autostart]]
 
+
* [[Openbox#Autostart]]
=== Openbox ===
+
* [[Awesome#Autostart]]
 
 
See [[Openbox#Startup programs]].
 

Latest revision as of 10:46, 24 April 2018

This article links to various methods to launch scripts or applications automatically when some particular event is taking place.

On bootup / shutdown

Use systemd services.

On user login / logout

Use systemd/User services.

On time events

Periodically at certain times, dates or intervals:

Once at a date and time:

On filesystem events

Use an inotify event watcher:

On shell login / logout

See Command-line shell#Configuration files.

On Xorg startup

On desktop environment startup

If the desktop environment has an ArchWiki article, see its Autostart section.

Most desktop environments implement XDG Autostart.

On window manager startup

If the window manager has an ArchWiki article, see its Autostart section.