This shows you the differences between two versions of the page.

Link to this comparison view

Last revisionBoth sides next revision
linux_commands [2020/04/09 14:33] – created misaka00251linux_commands [2020/04/18 17:48] – Add systemd misaka00251
Line 11: Line 11:
   * ''-a'' make a backup. Don't rely on it!   * ''-a'' make a backup. Don't rely on it!
   * ''-p'' Keep the properties of this file.   * ''-p'' Keep the properties of this file.
 +===== Systemd =====
 +A sample service file:
 +<code - gitea.service>
 +Description=Gitea (Git with a cup of tea)
 +ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
 +#Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/home/git
 +So, the right way to implement ''Environment'' is to run ''systemctl edit myservice''.
 +In normal installations this will create a directory ''/etc/systemd/system/myservice.service.d'', and inside that directory create a file whose name ends in ''.conf'' (typically, ''override.conf''), and in this file you can add to or override any part of the unit shipped by the distribution.
 +For instance, in a file /etc/systemd/system/myservice.service.d/myenv.conf:
 +Also note that if the directory exists and is empty, your service will be disabled! If you don't intend to put something in the directory, ensure that it does not exist.
 +[[https://serverfault.com/questions/413397/how-to-set-environment-variable-in-systemd-service|Copied from here]].