Remote execution of a script never exits but times out

10 views
Skip to first unread message

rahul raviz

unread,
Mar 9, 2022, 9:23:03 AM3/9/22
to Ansible Project
I am writing a task in a playbook which will execute a shell script on a remote server. But for some reason it never exits and hangs and then finally times out. When I run the script directly on the remote server, there are no errors. Here is the snippet of the task.

 - name: Run a script 
    shell: sh /tmp/setup.sh
    become: yes


The shell script setup.sh is below. What can I do to fix this?
=================================================
#!/bin/bash -x

ORACLE_HOME=/usr/lib/oracle/12.1/client64
LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib/
LIBRARY_PATH=$ORACLE_HOME/lib
PERL5OPT="-I/usr/local/lib64/perl5/DBD/ -I/usr/share/perl5/vendor_perl/CGI/ -I/usr/lib64/perl5/Sys/ -I/usr/share/perl5/vendor_perl/"

cd /apps/bx/zabbbx_scripts/DBD-Oracle-1.76
perl Makefile.PL && make && make install


cp /apps/bx/application/config/appdescriptor.xml /apps/bx/config/appdescriptor.xml.$date; mv /apps/bx/application/config/appdescriptor.xml /apps/bx/config/appdescriptor.xml; cd /apps/bx/application/config; ln -s /apps/bx/config/appdescriptor.xml appdescriptor.xml
chown -R azasx:azasx /apps/bx/application/config/
chown -R azasx:azasx /apps/bx/config/

chmod 755 /etc/zabbbx_agentd.conf
chmod -R 755 /usr/local/lib64/perl5/
chmod 755 /apps/bx/config/appdescriptor.xml
#timedatectl set-timezone America/Chicago



mkdir -p /apps/ix/log/zabbix_scripts/monitoring/application_processes/processes_info_zabbix/processes_info_zabbix
touch /apps/ix/log/zabbix_scripts/monitoring/application_processes/processes_info_zabbix/processes_info_zabbix/processes_info_zabbix
chown zabbix:azasx /apps/ix/log/zabbix_scripts/monitoring/application_processes/processes_info_zabbix/processes_info_zabbix/processes_info_zabbix

#Sysop Server:
mkdir -p /apps/ix/log/zabbix_scripts/monitoring/mq_queues/queues_info_zabbix

chmod -R 755 /apps/ix/log/zabbix_scripts/monitoring

#Continue for all node types:
cd /apps/ix/log
chown -R zabbix:azasx zabbix_scripts/
#For LOG: chown -R zabbix:zabbix zabbix_scripts/
chmod -R 775 zabbix_scripts/

cd /apps/ix
mkdir monitoring
chown zabbix:zabbix -R monitoring/


#As root:
service zabbix-agent start && tail -F /var/log/zabbix/zabbix_agentd.log
==========================================================


Matt Martz

unread,
Mar 9, 2022, 9:33:04 AM3/9/22
to ansible...@googlegroups.com
The very last line of that script is to tail the log file forever.  As such, the script never finishes.

Looking at the script, I'm questioning why you wouldn't turn it into a playbook and individual tasks instead of running that script.

--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/585c680c-b3ad-418d-bc77-1981908cd99cn%40googlegroups.com.


--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages