Run an action every 30 seconds

Hello,
I would like my Nginx server to run every 30 seconds a service job. This
job will just send a message to another server that the nginx is running
and OK. Does anybody know how to do it?
I have just one idea - to write a module that will send the OK message
to another server. Then cron will run each 1 minute (unfortunately 30
seconds is not possible) a script that will send a request to the
module.

Thanks in advance for your ideas,
Michal

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,173142,173142#msg-173142

how about linux crond?i think it will be much easier than moudle.

在 2011-2-8 下午6:37,“michalkraus” [email protected]写道:

Michal

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,173142,173142#msg-173142

Two options:

  1. Use cron if you can accept minimum 1 minute between every launch.
  2. Use a a script with a sleep() instruction and verify that the script
    is
    always running.
  3. Use a heartbeat solution - http://linux-ha.org/wiki/Main_Page
  • Gregory

2011/2/8 baalchina [email protected]

Three options:

  1. Cron if you can wait 1 minute.
  2. Script always running with sleep() instruction and check that the
    script
    is always running.
  3. HA/Heartbeat - http://linux-ha.org/wiki/Main_Page
  • Gregory

2011/2/8 baalchina [email protected]

On 08/02/11 11:05, Gregory Agerba wrote:

Two options:

  1. Use cron if you can accept minimum 1 minute between every launch.
  2. Use a a script with a sleep() instruction and verify that the script is
    always running.
  3. Use a heartbeat solution - http://linux-ha.org/wiki/Main_Page
  1. Use cron to start a script which does the test, sleeps for 30s, then
    does
    the test again, then dies (to be restarted by cron at the next minute)


Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450
Registered in England (0456 0902) @ 13 Clarke Rd, Milton Keynes, MK1 1LG

Thanks for your options

  1. Use a heartbeat solution - http://linux-ha.org/wiki/Main_Page

I have API between the Nginx and the second (control) server. I use RPC
interface. I need just send a RPC request (with status infrmation) to
the control server. I think that heartbeat is too robust.

  1. Use cron to start a script which does the test, sleeps for 30s,
    then does
    the test again, then dies (to be restarted by cron
    at the next minute)

This option seems to be the best but is any possibility the nginx to do
it in its own?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,173142,173166#msg-173166

On 8 Fev 2011 10h37 WET, [email protected] wrote:

Hello, I would like my Nginx server to run every 30 seconds a
service job. This job will just send a message to another server
that the nginx is running and OK. Does anybody know how to do it? I
have just one idea - to write a module that will send the OK message
to another server. Then cron will run each 1 minute (unfortunately
30 seconds is not possible) a script that will send a request to the
module.

Use the http://wiki.nginx.org/HttpEchoModule and a cron job that
checks a certain location and posts the message you wnat using curl to
the other server.

Just an idea

— appa

server {
listen 8082;
server_name localhost;

    location = /a-help2 {
        content_by_lua 'ngx.say(ngx.time())';
    }
    location = /a-help {
        proxy_pass http://127.0.0.1:8082/a-help2;
    }
    location = /a {
        echo_location /a-help;
        echo_sleep 2;
        echo_location /a-help;
    }
}

start a cron job to curl localhost:8082/a
just a sample conf.

require nginx-echo module( https://github.com/agentzh/echo-nginx-module
)

On Tue, Feb 8, 2011 at 7:35 PM, michalkraus [email protected]
wrote:

the test again, then dies (to be restarted by cron
[email protected]
http://nginx.org/mailman/listinfo/nginx


Regards,

林青(Kindy Lin)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs