Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-10125

Change sleep 10 with active wait on init.d scripts

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 2.4.7
    • Installation (I)

      sleeping 10 seconds at restart is too slow (I think)

      I propose, at least for moderns distributions (there where pgrep is present):

      # diff -u misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd
      --- misc/init.d/fedora/core/zabbix_agentd	2015-11-29 23:00:31.000000000 +0100
      +++ /etc/init.d/zabbix_agentd	2015-11-30 10:43:29.215831368 +0100
       	# Binary File
       	BINARY_NAME=zabbix_agentd
      @@ -96,7 +96,17 @@
       		;;
       	restart)
       		stop
      -		sleep 10
      +		((i=0))
      +		while pgrep -f $BASEDIR/sbin/$BINARY_NAME  &> /dev/null;
      +		do
      +			echo -n "."
      +			if [ $i -gt 20 ]
      +			then
      +				break;
      +			fi
      +			sleep 0.5
      +			((i++))
      +		done
      

      Additiionally, I would substitute ps | grep xxx | awk code with pgrep / pkill calls

      Regards,

            Unassigned Unassigned
            i5513 Javier Barroso
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: