49

Using one command to both start and enable systemctl managed software would be useful to spare a few lines in a few scripts, making them a bit more aesthetic (not really a problem but a nice thing to have).

Is there one systemctl command to both start and enable a program controlled by systemctl?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232

1 Answers1

69

Yes, there is, since systemd 220 (May 2015):

systemctl enable --now

This will enable and start the named units. See the systemctl manpage for details.

Stephen Kitt
  • 434,908