美文网首页
Linux软件备忘

Linux软件备忘

作者: 绿箭ML | 来源:发表于2017-10-29 17:19 被阅读32次

    linux个人软件备忘记录

    进程管理类


    supervisord

    python2的supervisord

    教程搬运工
    配置开机启动教程:开机启动教程

    #安装
    pip install supervisord
    

    生成配置文件到/etc

    echo_supervisord_conf >/etc/supervisord.conf
    

    conf文件配置(注意后面加了个#的是自己标注的,提示要设置)

    [unix_http_server]
    file=/tmp/supervisor.sock   ; the path to the socket file
    ;chmod=0700                 ; socket file mode (default 0700)
    ;chown=nobody:nogroup       ; socket file uid:gid owner
    ;username=user              ; default is no username (open server)
    ;password=123               ; default is no password (open server)
    
    [inet_http_server]         ; inet (TCP) server disabled by default
    port=*:9001        ; ip_address:port specifier, *:port for all iface
    username=user             ; default is no username (open server)#
    password=passwd               ; default is no password (open server)#
    
    [supervisorctl]
    serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socke t#
    serverurl=http://0.0.0.0:9001 ; use an http:// url to specify an inet socket #
    ;username=user             ; should be same as in [*_http_server] if set #
    ;password=passwd                ; should be same as in [*_http_server] if set #
    ;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
    ;history_file=~/.sc_history  ; use readline history if available
    
    [include]
    files = /etc/supervisord.d/*.ini   ;这里就是对应的加载配置某个进程的目录#
    

    新建一个进程ini配置的目录(注意这个目录会在/etc/supervisord.confinclude,目录名称和配置保持一致才能被加载)

    mkdir /etc/supervisord.d
    

    某个进程配置文件(保存到/etc/supervisord.d/xxx.ini)

    [program:进程名]
    command=绝对路径的命令/usr/local/bin/sslocal
    stdout_logfile=/var/log/log文件
    autostart=true
    autorestart=true
    startsecs=5
    priority=1
    stopasgroup=true
    killasgroup=true
    

    autostart是是否自动启动
    autorestart自动重启
    其他参数参考echo_supervisord_conf在最后的时候,有几个范例的说明

    开机启动配置(注意那些可执行文件都是用了绝对路径)
    保存文件位于在/usr/lib/systemd/system/supervisord.service
    具体要看系统,还可能存在于/lib/systemd/system/

    # dservice for systemd (CentOS 7.0+)
    # by ET-CS (https://github.com/ET-CS)
    [Unit]
    Description=Supervisor daemon
    
    [Service]
    Type=forking
    ExecStart=/usr/local/bin/supervisord -c /etc/supervisord.conf
    ExecStop=/usr/local/bin/supervisorctl shutdown
    ExecReload=/usr/local/bin/supervisorctl reload
    KillMode=process
    Restart=on-failure
    RestartSec=42s
    
    [Install]
    WantedBy=multi-user.target
    

    设置启动

    systemctl enable supervisord
    

    检查是否设置成功

    systemctl is-enabled supervisord
    

    手动启动

    #先启动服务
    supervisord -c /etc/supervisord.conf
    #然后设置
    sudo supvisorctl
    

    这是个它的界面,输入help获得帮助

    supervisor> help
    
    default commands (type help <topic>):
    =====================================
    add    exit      open  reload  restart   start   tail
    avail  fg        pid   remove  shutdown  status  update
    clear  maintail  quit  reread  signal    stop    version
    
    supervisor>
    

    其中reload是重启启动服务,包括读取配置文件,reread就是你新增配置文件的时候,可重新读取它

    网络管理


    bmon

    apt-get install bmon
    

    终端记录成动画

    aptitude install Termtosvg

    相关文章

      网友评论

          本文标题:Linux软件备忘

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