Difference between revisions of "Autostarting"

From ArchWiki
Jump to navigation Jump to search
(→‎Desktop Application Autostart: xdg autostart for unsupported environments)
m (→‎On window manager startup: maybe not most, but many)
 
(72 intermediate revisions by 23 users not shown)
Line 1: Line 1:
[[Category:Boot process]]
+
[[Category:System administration]]
 
[[es:Autostarting]]
 
[[es:Autostarting]]
[[ja:Autostarting]]
+
[[ja:自動起動]]
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.
+
[[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]].
 
  
=== 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]].
 
  
=== Runit ===
+
Use [[systemd]] services.
''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 ==
+
== On user login / logout ==
  
To autostart programs in console or upon login, you can use shell startup files/directories. Read the documentation for your shell, or its ArchWiki article, e.g. [[Bash#Configuration file sourcing order at startup]] or [[Zsh#Autostarting applications]].
+
Use [[systemd/User]] services.
  
See also [[Wikipedia:Unix shell#Configuration files for shells]].
+
== On device plug in / unplug ==
  
=== /etc/profile ===
+
Use [[udev]] rules.
  
{{ic|/etc/profile}} is sourced by all Bourne-compatible shells upon login: it sets up an environment upon login and application-specific settings by sourcing any readable {{ic|/etc/profile.d/*.sh}} scripts.
+
== On time events ==
  
== Graphical ==
+
Periodically at certain times, dates or intervals:
You can autostart programs automatically when you login into your [[Window Manager]] or [[Desktop Environment]].
 
  
=== X session startup ===
+
* [[systemd/Timers]]
 +
* [[Cron]]
  
See [[xinitrc]] and [[xprofile]].
+
Once at a date and time:
  
=== Desktop Application Autostart ===
+
* [[systemd/Timers]]
 +
* {{Pkg|at}}
  
The following folders contain {{ic|*.desktop}} files, which are executed every time an X session starts, determining which programs are loaded for which desktop environment:
+
== On filesystem events ==
  
* {{ic|$XDG_CONFIG_DIRS/autostart/}} ({{ic|/etc/xdg/autostart/}} by default)
+
Use an [[Wikipedia:inotify|inotify]] event watcher:
* {{ic|/usr/share/gnome/autostart/}} (GNOME only)
 
* {{ic|$XDG_CONFIG_HOME/autostart/}} ({{ic|~/.config/autostart/}} by default)
 
  
Users can override system-wide {{ic|*.desktop}} files by copying them into the user-specific {{ic|~/.config/autostart/}} folder.
+
* {{Pkg|inotify-tools}}, see {{man|1|inotifywait}}
 +
* [[Incron]]
 +
* {{AUR|fswatch}}
  
For an explanation of the desktop file standard refer to [http://standards.freedesktop.org/desktop-entry-spec/latest/ Desktop Entry Specification]. For a more specific description of directories used, [http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html Desktop Application Autostart Specification].
+
== On shell login / logout ==
  
Note that this method is supported only by XDG-compliant desktop environments. Tools like {{aur|dapper}}, {{aur|dex-git}}, or {{aur|fbautostart}} can be used to offer XDG autostart in unsupported desktop environments as long as some other autostart mechanism exists.
+
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]].
  
=== LXDE ===
+
== On desktop environment startup ==
  
See [[LXDE#Autostart programs]].
+
Most [[desktop environment]]s implement [[XDG Autostart]].
  
=== Fluxbox ===
+
If the desktop environments has an article, see its ''Autostart'' section.
  
See [[Fluxbox#Autostart programs]].
+
* [[GNOME#Autostart]]
 +
* [[KDE#Autostart]]
 +
* [[Xfce#Autostart]]
 +
* [[LXDE#Autostart]]
 +
* [[LXQt#Autostart]]
  
=== Openbox ===
+
== On window manager startup ==
  
See [[Openbox#Startup programs]].
+
Many [[window manager]]s implement [[XDG Autostart]].
 +
 
 +
If the [[window manager]] has an article, see its ''Autostart'' section.
 +
 
 +
* [[Fluxbox#Autostart]]
 +
* [[Openbox#Autostart]]
 +
* [[Awesome#Autostart]]
 +
* [[i3#Autostart]]

Latest revision as of 21:10, 28 May 2019

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 device plug in / unplug

Use udev rules.

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

Most desktop environments implement XDG Autostart.

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

On window manager startup

Many window managers implement XDG Autostart.

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