美文网首页
(杂项)Debian9开机自动执行脚本

(杂项)Debian9开机自动执行脚本

作者: Jesse4023 | 来源:发表于2020-01-31 22:49 被阅读0次

    Debian 9 默认不带 /etc/rc.local 文件?而 rc.local 服务却还是自带的。

    参考该篇文章链接

    例如开机后台启动frp服务。

    root@phicomm:~/frp_0.28.2_linux_arm64# cat startfrpc.sh
    #!/bin/sh
    cd /root/frp_0.28.2_linux_arm64
    ./frpc -c frpc.ini 1>/dev/null 2>&1 &

    1>/dev/null 2>&1 &保持后台运行

    对应rc.local文件

    root@phicomm:~/frp_0.28.2_linux_arm64# cat /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.
    /root/frp_0.28.2_linux_arm64/startfrpc.sh
    exit 0

    再执行:

    systemctl enable rc-local
    systemctl start rc-local.service

    相关文章

      网友评论

          本文标题:(杂项)Debian9开机自动执行脚本

          本文链接:https://www.haomeiwen.com/subject/gfwnthtx.html