tiancheng91 / collection

笔记
https://github.com/tiancheng91/collection/issues
22 stars 1 forks source link

systemd #31

Open tiancheng91 opened 5 years ago

tiancheng91 commented 5 years ago
curl cheat.sh/systemctl
# reload unit conf
systemctl daemon-reload

# List all loaded/active units
systemctl list-units

# Check the status of a service
systemctl status foo.service

# Start a service
systemctl start foo.service

# Restart a service
systemctl restart foo.service

# Stop a service
systemctl stop foo.service

# Reload a service's configuration
systemctl reload foo.service

# Enable a service to startup on boot
systemctl enable foo.service

# Disable a service to startup on boot
systemctl disable foo.service

# List the dependencies of a service
# when no service name is specified, lists the dependencies of default.target
systemctl list-dependencies foo.service 

# List currently loaded targets
systemctl list-units --type=target

# Change current target
systemctl isolate foo.target

# Change default target
systemctl enable foo.target
tiancheng91 commented 5 years ago

template

[Unit]
Description=GitLab Runner
After=network.target
ConditionFileIsExecutable=/usr/bin/gitlab-runner
Wants=overture.service

[Service]
#Environment="DAEMON_ARGS=--debug"
Environment="DAEMON_ARGS=run --working-directory /var/lib/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --syslog --user gitlab-runner"
EnvironmentFile=-/etc/default/%p
StartLimitInterval=5
StartLimitBurst=10
WorkingDirectory=/usr/local
ExecStart=/usr/bin/gitlab-runner $DAEMON_ARGS
ExecReload=/bin/kill -HUP $MAINPID

Restart=always
RestartSec=120

[Install]
WantedBy=multi-user.target
tiancheng91 commented 4 years ago

wifi 自动重连

ping -I wlan0 -c2 114.114.114.114 > /dev/null 2>&1 || iw wlan0 connect QTT-WiFi