Skip to content

Instantly share code, notes, and snippets.

@mshuler
Forked from kashyapp/lrsync.lua
Created December 3, 2020 16:41
Show Gist options
  • Select an option

  • Save mshuler/94e7ea89c48048797674c37876945a84 to your computer and use it in GitHub Desktop.

Select an option

Save mshuler/94e7ea89c48048797674c37876945a84 to your computer and use it in GitHub Desktop.

Revisions

  1. @kashyapp kashyapp revised this gist Mar 20, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions lrsync.lua
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,8 @@ settings {
    }

    -- OPS-STORAGE
    local storage_disabled = false
    if (storage_disabled) then
    local storage_enabled = false
    if (storage_enabled) then
    sync {
    default.rsync,
    source = "/var/lib/fk-pf-cfgsvc/data",
  2. @kashyapp kashyapp revised this gist Mar 20, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion lrsync.lua
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,8 @@ settings {
    }

    -- OPS-STORAGE
    if (false) then
    local storage_disabled = false
    if (storage_disabled) then
    sync {
    default.rsync,
    source = "/var/lib/fk-pf-cfgsvc/data",
  3. @kashyapp kashyapp revised this gist Mar 20, 2013. 1 changed file with 57 additions and 0 deletions.
    57 changes: 57 additions & 0 deletions lrsync.lua
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    local hostname = os.getenv("HOSTNAME")
    local package = os.getenv("PACKAGE")
    assert(hostname, "HOSTNAME env variable is not set")
    assert(package, "PACKAGE env variable is not set")

    local privateKey = "/usr/share/" .. package .. "/etc/id_rsa"

    settings {
    statusFile = "/var/run/" .. package .. "/lsyncd.stat",
    statusInterval = 60,
    nodaemon = true,
    -- maxDelays = 100,
    -- maxProcesses = 2,
    }

    -- OPS-STORAGE
    if (false) then
    sync {
    default.rsync,
    source = "/var/lib/fk-pf-cfgsvc/data",
    target = "storage::fk-storage/ConfigServiceData/" .. hostname,
    exclude = {
    "*.tmp",
    },
    rsync = {
    verbose = false,
    timeout = 120,
    },
    -- delete = false,
    }
    end

    -- PEER SERVER
    local peers = {
    ["pf-config-manage-1"] = "pf-config-manage-2",
    ["pf-config-manage-2"] = "pf-config-manage-1",
    ["stage-pf-config-manage-1"] = "stage-pf-config-manage-2",
    ["stage-pf-config-manage-2"] = "stage-pf-config-manage-1",
    }

    if (peers[hostname]) then
    sync {
    default.rsync,
    source = "/var/lib/fk-pf-cfgsvc/data",
    target = peers[hostname] .. ":/var/lib/fk-pf-cfgsvc/" .. hostname,
    exclude = {
    "*.tmp",
    },
    rsync = {
    verbose = false,
    timeout = 120,
    _extra = {
    "-e ssh -i " .. privateKey .. " -l fk-pf-cfgsvc -o StrictHostKeyChecking=no"
    },
    },
    }
    end
  4. @kashyapp kashyapp renamed this gist Feb 15, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. @kashyapp kashyapp created this gist Feb 15, 2013.
    5 changes: 5 additions & 0 deletions lsyncd.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    $ wget https://lsyncd.googlecode.com/files/lsyncd-2.1.4.tar.gz
    $ sudo apt-get install lua5.1 liblua5.1-dev
    $ ./configure
    # comment out the check for asciidoc if it errors out and run configure again
    $ make