这是脚本,chmod +x给过了权限
[ol]#!/bin/sh
workdir=$(dirname "$0")
cd $workdir
nohup $workdir/hbbs -k _ >> $workdir/nohup.out 2>&1 &
nohup $workdir/hbbr -k _ >> $workdir/nohup.out 2>&1 &
exit 0[/ol]复制代码
然后添加自启,在etc/systemd/system/rustdesk-autostart.service
[ol][Unit]
Description=rustdesk-autostart Server
After=network-online.target
[Service]
Type=simple
ExecStart=/root/rustdesk/rustdesk-start.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target[/ol]复制代码
然后设置开机启动,并启动[ol]systemctl enable rustdesk-autostart.service
systemctl daemon-reload
systemctl start rustdesk-autostart.service[/ol]复制代码
但是每隔一周左右,ps -ef | grep hbb就会看不到进程,需要reboot以下才正常