User Tools

Site Tools


linux_commands

Table of Contents

Linux Commands

Copy

copy “new” folder to the “old” folder, and cover all files in “old”.

cp -frap new/* old/
  • -f is force
  • -r means recursive, include any folder
  • -a make a backup. Don't rely on it!
  • -p Keep the properties of this file.

Systemd

A sample service file:

gitea.service
[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 .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:

[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.

Copied from here.

linux_commands.txt · Last modified: 2020/04/19 01:48 by misaka00251