On Wednesday, 26 September 2018 05.27.59 CEST Makesh wrote:
> Hi Team,
> 
> Am automating my TIbco EMS restart service using Ansible. I have tried to 
> execute the shell script from the server where ansible installed and also 
> remote server but the service is not coming up also not getting any error, 
> the same script execution was successful if run shell script in both Remote 
> and Ansible server.  Please help.
> 
> My Play book.
> 
> ---
> - hosts: all
>   remote_user: tibco
> 
>   tasks:
>   - name: Start the EMS  services
>     script:  TibemsStatus.sh {{emsserver}} {{actions}}
>     register: startemsoutput
>   - debug:
>       var: startemsoutput.stdout_lines
> 
> 
> My Shell script
> 
> case "$2" in
>   start)
>         if [ $PID ]; then
>                 echo "ems is already running for config file $conf_file. 
> Check process id $PID";
>         else
>                 echo "Starting tibems daemon for config file $conf_file."
> #                cd $TIBEMS_ROOT && ./tibemsd64 -config $conf_file >  
> /dev/null 2>&1 &
>                 (/opt/tibco/ems/8.3/bin/tibemsd64 -config $conf_file > 
> /dev/null 2>&1 &) && exit
>                 sleep 5
>                 PROCESS_PID;
>                         if [ $PID ]; then
>                         echo "Done. Started ./tibemsd64 -config $conf_file 
> The process id is [ $PID ]"
>                         else
>                         echo "Could not start ./tibemsd64 on this box for 
> config $conf_file"
>                 fi
>         fi

When the Ansible script task is finished all the child processes will be 
stopped.
To avoid that create proper init script to start and stop services.


-- 
Kai Stian Olstad


-- 
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/38461284.qn3Olu90Ct%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to