copy “new” folder to the “old” folder, and cover all files in “old”.
cp -frap new/* old/
-rmeans recursive, include any folder
-amake a backup. Don't rely on it!
-pKeep the properties of this file.
A sample service file:
[Unit] Description=Gitea (Git with a cup of tea) After=syslog.target After=network.target #After=mysqld.service #After=postgresql.service #After=memcached.service #After=redis.service [Service] #LimitMEMLOCK=infinity #LimitNOFILE=65535 RestartSec=2s Type=simple User=git Group=git WorkingDirectory=/home/git ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini Restart=always #Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/home/git [Install] WantedBy=multi-user.target
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
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:
[Service] Environment="USER=git" Environment="HOME=/home/git" Environment="GITEA_WORK_DIR=/home/git"
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.