跳至主要内容

博文

目前显示的是 十一月, 2021的博文

rclone 自启动脚本

  [Unit] Description=RClone Service Dropbox Wants=network-online.target After=network-online.target [Service] Type=notify Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf KillMode=none RestartSec=5 ExecStart=/usr/bin/rclone mount dcrypt: /DB \ # This is for allowing users other than the user running rclone access to the mount --allow-other \ # Dropbox is a polling remote so this value can be set very high and any changes are detected via polling. --dir-cache-time 5000h \ # Log file location --log-file /opt/rclone/logs/dropbox.log \ # Set the log level --log-level NOTICE \ # I reduce the poll interval down to 10 seconds as this makes changes fast --poll-interval 10s \ # This is setting the file permission on the mount to user and group have the same access and other can read --umask 002 \ # This sets up the remote control daemon so you can issue rc commands locally --rc \ # This is the default port it runs on --rc-addr :5572 \ # no-auth is used as no one else uses my server and it...

Systemctl--Linux新的自启动方式

  启动示例 systemctl start $name # 启动 systemctl stop $name # 停止 systemctl enable $name # 开启开机自启 systemctl disable $name # 关闭开机自启 配置文件示例 [Unit] # 这个项目与此 unit 的解释、执行服务相依性有关 Description=OpenSSH server daemon # 描述性内容 After=network.target # 在网络启动后 Wants=sshd-keygen.service [Service] # 这个项目与实际执行的指令参数有关 EnvironmentFile=/etc/sysconfig/sshd ExecStart=/usr/sbin/sshd -D $OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s [Install] # 这个项目说明此 unit 要挂载哪个 target 下面 WantedBy=multi-user.target 摘自 这里 的介绍 不想整理了,放在excel里了 链接 rssbot的配置文件示例 [Unit] Description=RSSBOT After=network.target [Service] Type=simple ExecStart=/root/rssbot/run.sh Restart=always [Install] WantedBy=multi-user.target systemd有系统和用户区分;系统(/user/lib/systemd/system/)、用户(/etc/lib/systemd/user/). 一般系统管理员手工创建的单元文件建议存放在/etc/systemd/system/目录下面。 注意事项: [Service] 里面用绝对路径,如 sh换成 /usr/bin/sh systemctl status rssbot.service 查看服务状态 systemctl daemon-reload 刷新服务状态 就这样了,做...