V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
love
V2EX  ›  Linux

有了 systemd 是不是就可以抛弃 supervisor 了?

  •  
  •   love · 2015-02-28 14:04:24 +08:00 · 20119 次点击
    这是一个创建于 3337 天前的主题,其中的信息可能已经有所发展或是发生改变。
    之前的程序一直是用supervisor来控制,相比写rc脚本是方便多了。
    最近用上centos7后作业控制系统变成了systemd,扫了下文档发现写服务描述文件很方便,不比supervisor麻烦多少了,这样的话supervisor好象没必要用了吧。
    23 条回复    2018-02-01 10:39:43 +08:00
    cevincheung
        1
    cevincheung  
       2015-02-28 14:10:58 +08:00
    已替换
    kk71
        2
    kk71  
       2015-02-28 14:14:54 +08:00
    supervisor可以通过网页执行启动停止的操作
    mahone3297
        3
    mahone3297  
       2015-02-28 14:16:00 +08:00
    好问题。。。看看大家的答案。。。
    pertent
        4
    pertent  
       2015-02-28 14:38:27 +08:00 via Android
    我也觉得,配置文件跟supervisor一样简单了
    Yamade
        5
    Yamade  
       2015-02-28 14:52:19 +08:00
    那么问题来了,Ubuntu怎么办?
    Yamade
        6
    Yamade  
       2015-02-28 14:54:25 +08:00
    貌似在ubuntu也加入了。抱歉。没看wiki
    weelyai
        7
    weelyai  
       2015-02-28 15:11:46 +08:00
    RHEL 7 里面已经换成systemd了。 最大的诱惑还是在启动上面。 原来是顺序启动,慢而且很容易卡住。而systemd,可以并发启动服务,自动解决服务之间的相互依赖。
    ujmxyd
        8
    ujmxyd  
       2015-02-28 15:15:24 +08:00 via iPad
    Ubuntu从今年的15.04 Vivid开始默认使用Systemd,之前的也可以参考Wiki安装
    反正用Systemd来管理守护进程挺方便的,Log用journalctl或者systemctl status查看也挺方便的
    好吧,我承认我没用过Supervisor,Centos只用过Centos 7
    esyed
        9
    esyed  
       2015-02-28 16:04:20 +08:00
    不是通过vim修改配置么?
    ibigbug
        10
    ibigbug  
       2015-02-28 16:28:20 +08:00
    OS X 怎么办
    dorentus
        11
    dorentus  
       2015-02-28 16:46:04 +08:00
    @ibigbug OS X 不是早就有 launchd 了么?
    msg7086
        12
    msg7086  
       2015-02-28 16:55:56 +08:00
    Debian jessie 表示用了 systemd 以后再也不用写又臭又长还容易出错的 rc.d 了。
    ibigbug
        13
    ibigbug  
       2015-02-28 17:58:33 +08:00
    @dorentus 我一直没觉得那是给人用的
    Yamade
        14
    Yamade  
       2015-02-28 18:16:15 +08:00
    ```
    [Unit]
    Description=ghost
    After=network.target

    [Service]
    Type=simple
    # Edit WorkingDirectory, User and Group as needed
    WorkingDirectory=/path/to/Ghost
    User=http
    Group=http
    ExecStart=/usr/bin/npm start --production
    ExecStop=/usr/bin/npm stop --production
    Restart=always
    SyslogIdentifier=Ghost

    [Install]
    WantedBy=multi-user.target

    ```
    看了下配置不错
    lilydjwg
        15
    lilydjwg  
       2015-02-28 18:43:21 +08:00   ❤️ 2
    我也喜欢 systemd 的服务管理。不过日志部分还是喜欢 syslog-ng + logrotate。纯文本看起来方便,journalctl 找日志挺慢的。
    ryanking8215
        16
    ryanking8215  
       2015-02-28 20:38:59 +08:00
    supervisor有自动重启服务的功能,systemd有吗?
    love
        17
    love  
    OP
       2015-02-28 21:28:57 +08:00
    @ryanking8215 去看文档,不但有,而且功能更全面。
    thonatos
        18
    thonatos  
       2015-02-28 21:39:43 +08:00
    crontab.
    xierch
        19
    xierch  
       2015-03-01 02:39:59 +08:00
    @thonatos systemd-timer
    digimoon
        20
    digimoon  
       2015-03-01 03:59:24 +08:00
    systemd一个配置文件只能一个程序吗?
    例如我想只输入systemctl restart gfw就能重启chinadna dnsmasq ss-tunnel ss-local或更多程序
    ryd994
        21
    ryd994  
       2015-03-01 10:17:26 +08:00 via Android
    @digimoon 用dependency去拉
    或者写一个bash脚本调用
    loveminds
        22
    loveminds  
       2017-07-05 20:07:57 +08:00
    @ryanking8215 有,而且功能强大
    @kk71 有,cockpit
    lilydjwg
        23
    lilydjwg  
       2018-02-01 10:39:43 +08:00
    @digimoon #20 做一个 gfw.target ?

    @ryanking8215 #16 重启当然没问题。systemd 还能跟踪 fork 出来的进程,supervisord 可不行。

    @xierch #19 systemd.timer 不会发邮件 :-(
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1017 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:27 · PVG 03:27 · LAX 12:27 · JFK 15:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.