编辑/etc/rc.local
duoyi@duoyi-IT-Server:/etc/samba$ sudo vim.tiny /etc/rc.local
#!/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.
/usr/bin/python3 /home/duoyi/ServerStatus/ServerStatus.py &
exit 0
只需要在后面加上 /usr/bin/python3 /home/duoyi/ServerStatus/ServerStatus.py & 即可,最后这个&字符表示后台启动
网友评论