The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
Nxxx

关于 go 多平台 配置开机启动

  •  
  •   Nxxx · Apr 26, 2022 · 2466 views
    This topic created in 1503 days ago, the information mentioned may be changed or developed.

    老哥哥们 我又来问问题了= = 就是 我现在在写一个开源 项目 部署环境 有 windows 和 linux 我在想有没有什么第三方包可以自动配置 开机自动启动还有这种需求呢 如果有知道老哥能说下吗 谢谢了

    9 replies    2022-04-27 17:44:17 +08:00
    Nxxx
        1
    Nxxx  
    OP
       Apr 26, 2022
    目前找到一个 https://github.com/kardianos/service 这个包 但是现在主流的只支持到 winxp = =
    Nxxx
        2
    Nxxx  
    OP
       Apr 26, 2022
    @Nxxx 支持 win10= = 我去试试
    codefever
        3
    codefever  
       Apr 26, 2022   ❤️ 1
    Linux:
    首先是安装包安装,linux 用户可以去下载地址下载 tar.gz 格式的安装包,通过终端解压到指定目录.
    Windows:
    首先用安装包安装,同样去 google code 下载安装包。下载到电脑上以后直接执行安装就可以了。建议默认安装,不要修改安装目录。验证方法同上,在 cmd 中运行 go ,检查会不会出现 go 的信息。如果不行尝试从新安装或者重启。
    licoycn
        4
    licoycn  
       Apr 26, 2022
    可以理解为是要进程管理麽,直接采用 [pm2]( https://pm2.keymetrics.io/) 即可。
    haochen2
        5
    haochen2  
       Apr 26, 2022
    @codefever 问的不是咋安装 Go 开发环境
    wheeler
        6
    wheeler  
       Apr 26, 2022 via iPhone
    systemd
    docker restart always
    dzdh
        8
    dzdh  
       Apr 27, 2022
    systemd+1

    [Unit]
    Description=简单说明是个啥

    [Service]
    Type=simple/forking 你的程序是不是 background
    User=启动用户
    ExecStart=/xxxx/bin/xx
    Restart=on-failure

    [Install]
    WantedBy=multi-user.target

    systemctl enable --now xxx.service 就好了
    soseek
        9
    soseek  
       Apr 27, 2022 via iPhone
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2687 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 88ms · UTC 10:54 · PVG 18:54 · LAX 03:54 · JFK 06:54
    ♥ Do have faith in what you're doing.