cndaqiang / E5-PC-daily

服务器集群管理遇到的问题和总结
1 stars 0 forks source link

systemctl #12

Open cndaqiang opened 4 years ago

cndaqiang commented 4 years ago

shell 窗口过小,容易看不全出错原因 image image

cndaqiang commented 4 years ago
[Unit]
Description=Frpc Client
Wants=network-online.target
After=network-online.target
[Service]
User=root
WorkingDirectory=/opt/
LimitNOFILE=4096
PIDFile=/var/run/frpc/client.pid
ExecStart=/opt/frp/frpc -c /opt/frp/frpc.ini
Restart=on-failure
StartLimitInterval=600
[Install]
WantedBy=multi-user.target
cndaqiang commented 3 years ago

开机自启

cat > /etc/systemd/system/rc-local.service <<EOF
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
Alias=rc-local.service
EOF
cat > /etc/rc.local <<EOF
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0
EOF
chmod +x /etc/rc.local
systemctl enable rc-local
systemctl start rc-local.service