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.
Contents
Daemons
You can start your scripts or applications as daemons, see Daemon.
Systemd
systemd is the default init framework, replacing initscripts. The services which are started by systemd can be found in the subfolders of /etc/systemd/system/
. Services can be enabled using the systemctl
command. For more information about systemd and how to write autostart scripts for it, see at systemd. To autostart scripts for specific users, see systemd/User.
Cron
Cron can be used to autostart non-GUI system setup tasks.
Shells
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 files or Zsh#Startup/Shutdown files.
See also Wikipedia:Unix shell#Configuration files for shells.
/etc/profile
Upon login, all Bourne-compatible shells source /etc/profile
, which in turn sources any readable *.sh
files in /etc/profile.d/
: these scripts do not require an interpreter directive, nor do they need to be executable. They are used to set up an environment and define application-specific settings.
Graphical
You can autostart programs automatically when you login into your Window manager or Desktop environment.
X session startup
Desktop entries
See Desktop entries#Autostart.
GNOME
See GNOME#Startup applications.
KDE Plasma
See KDE#Autostarting applications.
Xfce
See Xfce#Startup applications.
LXDE
See LXDE#Autostart.
LXQt
See LXQt#Autostarting applications.
Fluxbox
See Fluxbox#Autostart programs.
Openbox
See Openbox#autostart.