Daemonizing an executable in ansible

后端 未结 5 478
借酒劲吻你
借酒劲吻你 2020-12-15 17:55

I am trying to create a task in ansible which executes a shell command to run an executable in daemon mode using &. Something like following

-name: Star         


        
5条回答
  •  甜味超标
    2020-12-15 18:32

    I found the best way, particularly because I wanted output to be logged, was to use the "daemonize" package. If you are on CentOS/Redhat, like below. There is probably also an apt-package for it.

    - name: yum install daemonize
      yum:
        name: daemonize
        state: latest
    
    - name: run in background, log errors and standout to file
      shell:  daemonize -e /var/log/myprocess.log -o /var/log/myprocess.log  /opt/myscripts/myprocess.sh
    

提交回复
热议问题