1、安装安装screen

sudo apt-get  install  screen

2、新建一个启动脚本

sudo nano /usr/local/nat123/nat123.sh

内容如下:

#!/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.
sleep 15s
cd /usr/local/nat123
screen -S nat123
mono nat123linux.sh service
exit 0

保存并退出,授予nat123.sh可执行的权限

sudo chmod +x /usr/local/nat123/nat123.sh

3、把nat123.sh加入开机启动项

sudo nano /etc/rc.local

在"exit 0"上面加入:“sudo sh /usr/local/nat123/nat123.sh”

保存并退出

4、重启系统

sudo reboot


注意:本文归作者所有,未经作者允许,不得转载