Hi,

you coud do this in /etc/init/d/graylog-server

Add a sleep of 10-15 secs right after start.

  start() {
      /bin/sleep 10


On Friday, June 12, 2015 at 9:50:04 AM UTC+2, Ubay wrote:
>
> Hello,
>
>    Is there any way to delay the startup of graylog until the elastic 
> search state is green?
>
>    Thank you .
>
>    Regards.
>
> El miércoles, 23 de abril de 2014, 21:44:13 (UTC+1), Charles Farinella 
> escribió:
>>
>> Elasticsearch apparently takes a little while to come up on boot, the 
>> cluster state is indeed red when the machine first boots, shortly after 
>> goes to yellow.  I'll have to spend some time learning a little about 
>> elasticsearch, in the meantime it's not all that difficult to start graylog 
>> manually.  Thanks for your help.
>>
>> On Thursday, April 17, 2014 4:33:11 PM UTC-4, Charles Farinella wrote:
>>>
>>> CentOS 6.5, Graylog2 0.20.1, Elasticsearch-0.90.10-1
>>>
>>> I have an init.d script that starts the graylog server fine if I run it 
>>> manually.  I have it in chkconfig hoping to start it at boot but it fails. 
>>>  All related services including the graylog2-web-interface start 
>>> successfully.  Below find the error and the start script.  Why does it 
>>> start fine manually and not at boot?
>>>
>>>
>>> ################################################################################
>>>
>>>
>>> 2014-04-17 15:04:56,720 INFO : org.graylog2.Main - Graylog2 0.20.1 
>>> starting up. (JRE: Oracle Corporation 1.7.0_51 on Linux 
>>> 2.6.32-431.5.1.el6.x86_64)
>>> 2014-04-17 15:04:57,786 INFO : org.graylog2.plugin.system.NodeId - Node 
>>> ID: 46cb0d6a-9e2f-43d8-92d1-dda391daa727
>>> 2014-04-17 15:04:57,827 INFO : org.graylog2.Core - No rest_transport_uri 
>>> set. Falling back to [http://192.168.24.94:12900].
>>> 2014-04-17 15:04:59,348 INFO : org.graylog2.buffers.ProcessBuffer - 
>>> Initialized ProcessBuffer with ring size <1024> and wait strategy 
>>> <BlockingWaitStrategy>.
>>> 2014-04-17 15:04:59,413 INFO : org.graylog2.buffers.OutputBuffer - 
>>> Initialized OutputBuffer with ring size <1024> and wait strategy 
>>> <BlockingWaitStrategy>.
>>> 2014-04-17 15:05:01,700 INFO : org.elasticsearch.node - 
>>> [graylog2-server] version[0.90.10], pid[1893], 
>>> build[0a5781f/2014-01-10T10:18:37Z]
>>> 2014-04-17 15:05:01,700 INFO : org.elasticsearch.node - 
>>> [graylog2-server] initializing ...
>>> 2014-04-17 15:05:01,833 INFO : org.elasticsearch.plugins - 
>>> [graylog2-server] loaded [], sites []
>>> 2014-04-17 15:05:12,156 INFO : org.elasticsearch.node - 
>>> [graylog2-server] initialized
>>> 2014-04-17 15:05:12,156 INFO : org.elasticsearch.node - 
>>> [graylog2-server] starting ...
>>> 2014-04-17 15:05:12,295 INFO : org.elasticsearch.transport - 
>>> [graylog2-server] bound_address {inet[/0:0:0:0:0:0:0:0:9350]}, 
>>> publish_address {inet[/192.168.24.94:9350]}
>>> 2014-04-17 15:05:15,317 WARN : org.elasticsearch.discovery - 
>>> [graylog2-server] waited for 3s and no initial state was set by the 
>>> discovery
>>> 2014-04-17 15:05:15,318 INFO : org.elasticsearch.discovery - 
>>> [graylog2-server] graylog2/OFJUviCYTXmxhtOhJqeuLw
>>> 2014-04-17 15:05:15,319 INFO : org.elasticsearch.node - 
>>> [graylog2-server] started
>>> 2014-04-17 15:05:15,452 INFO : org.elasticsearch.cluster.service - 
>>> [graylog2-server] detected_master 
>>> [Yellowjacket][6iyatNtCTrKZBpH-_urraQ][inet[/192.168.24.94:9300]], added 
>>> {[Yellowjacket][6iyatNtCTrKZBpH-_urraQ][inet[/192.168.24.94:9300]],}, 
>>> reason: zen-disco-receive(from master 
>>> [[Yellowjacket][6iyatNtCTrKZBpH-_urraQ][inet[/192.168.24.94:9300]]])
>>> 2014-04-17 15:05:20,352 ERROR: org.graylog2.Main - 
>>>
>>>
>>> ################################################################################
>>>
>>> ERROR: No ElasticSearch master was found.
>>>
>>>
>>> ================
>>> /etc/init.d/graylog2-server:
>>> ================
>>> #!/bin/sh
>>> #
>>> # graylog2-server:   graylog2 message collector
>>> #
>>> # chkconfig: - 96 02
>>> # description:  This daemon listens for syslog and GELF messages and 
>>> stores them in mongodb
>>> #
>>> CMD=$1
>>> NOHUP=`which nohup`
>>> JAVA_HOME=/usr/java/latest
>>> JAVA_CMD=/usr/bin/java
>>> GRAYLOG2_SERVER_HOME=/opt/graylog2-server
>>>  
>>> start() {
>>>     echo "Starting graylog2-server ..."
>>>     $NOHUP $JAVA_CMD -jar $GRAYLOG2_SERVER_HOME/graylog2-server.jar > 
>>> /var/log/graylog2.log 2>&1 &
>>> }
>>>  
>>> stop() {
>>>         PID=`cat /tmp/graylog2.pid`
>>>     echo "Stopping graylog2-server ($PID) ..."
>>>         kill $PID
>>> }
>>>  
>>> restart() {
>>>     echo "Restarting graylog2-server ..."
>>>         stop
>>>         start
>>> }
>>>  
>>> case "$CMD" in
>>>     start)
>>>         start
>>>         ;;
>>>     stop)
>>>         stop
>>>         ;;
>>>     restart)
>>>         restart
>>>         ;;
>>>     *)
>>>         echo "Usage $0 {start|stop|restart}"
>>>         RETVAL=1
>>> esac
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"graylog2" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to