not sure if you would get different results, but maybe try nohup instead of 
disown.  ie.
- name: execute sar iostat scripts shell: nohup top -bd $MON_INTERVAL > 
$GLUSTER_PROFILER_RESULTS/top_proc.$HOSTNAME.txt &

Another option could be to use the "at" module to schedule a task to start 
immediately. ie..

- name: Schedule a command to execute in 0 minutes as root. 
  at: 
    command: top -bd $MON_INTERVAL > 
$GLUSTER_PROFILER_RESULTS/top_proc.$HOSTNAME.txt 
    count: 0 
    units: minutes


On Tuesday, May 14, 2019 at 11:23:42 PM UTC-7, Kaustav Majumder wrote:
>
> Hi all, i am trying to top , sar , iostats in the backgound via ansible on 
> remote hosts and collect stats redirecting outpu to a log file while I run 
> other tasks from my local machine. I have tried - name: collect hypervisor 
> stats hosts: all tasks: - name: execute sar iostat scripts shell: top -bd 
> $MON_INTERVAL > $GLUSTER_PROFILER_RESULTS/top_proc.$HOSTNAME.txt & disown 
> but it stops by itself. I want to kill the tasks after sometime manually. 
> Is there any way
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/da859989-caa7-491e-93ea-23eb64f2bf06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to