mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-02-02 03:48:24 +00:00
This commit is contained in:
parent
40ce23235c
commit
297f110d1f
@ -1,7 +1,7 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#AC_PREREQ(2.60)
|
||||
AC_INIT(lsyncd, 2.0b1, axkibe@gmail.com)
|
||||
AC_INIT(lsyncd, 2.0beta1, axkibe@gmail.com)
|
||||
AC_CONFIG_SRCDIR([lsyncd.c])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AM_INIT_AUTOMAKE(lsyncd, main)
|
||||
|
@ -13,30 +13,27 @@ settings = {
|
||||
------
|
||||
-- for testing purposes
|
||||
--
|
||||
slower = "sleep 1 && "
|
||||
prefix = "sleep 1 && "
|
||||
slowbash = {
|
||||
delay = 5,
|
||||
|
||||
startup = function(source, target)
|
||||
log(NORMAL, "cp -r from "..source.." -> "..target)
|
||||
return exec("/bin/bash", "-c", [[if [ "$(ls -A $1)" ]; then cp -r "$1"* "$2"; fi]],
|
||||
"/bin/bash", source, target)
|
||||
return shell([[if [ "$(ls -A $1)" ]; then cp -r "$1"* "$2"; fi]], source, target)
|
||||
end,
|
||||
|
||||
create = function(source, path, name, target)
|
||||
local src = source..path..name
|
||||
local trg = target..path..name
|
||||
log(NORMAL, "create from "..src.." -> "..trg)
|
||||
return exec("/bin/bash", "-c", slower..[[cp "$1" "$2"]],
|
||||
"/bin/bash", src, trg)
|
||||
return shell(prefix..[[cp "$1" "$2"]], src, trg)
|
||||
end,
|
||||
|
||||
modify = function(source, path, name, target)
|
||||
local src = source..path..name
|
||||
local trg = target..path..name
|
||||
log(NORMAL, "modify from "..src.." -> "..trg)
|
||||
return exec("/bin/bash", "-c", slower..[[cp "$1" "$2"]],
|
||||
"/bin/bash", src, trg)
|
||||
return shell(prefix..[[cp "$1" "$2"]], src, trg)
|
||||
end,
|
||||
|
||||
attrib = function(source, path, name, target)
|
||||
@ -45,9 +42,9 @@ slowbash = {
|
||||
end,
|
||||
|
||||
delete = function(source, path, name, target)
|
||||
log(NORMAL, "delete "..target..path..name)
|
||||
return exec("/bin/bash", "-c", slower..[[rm "$1"]],
|
||||
"/bin/bash", target..path..name)
|
||||
local trg = target..path..name
|
||||
log(NORMAL, "delete "..trg)
|
||||
return exec(prefix..[[rm "$1"]], trg)
|
||||
end,
|
||||
|
||||
-- move = function(source, path, name, destpath, destname, target)
|
||||
|
10
lsyncd.lua
10
lsyncd.lua
@ -19,7 +19,7 @@ if lsyncd_version then
|
||||
print("You cannot use the lsyncd runner as configuration file!")
|
||||
os.exit(-1)
|
||||
end
|
||||
lsyncd_version = "2.0b1"
|
||||
lsyncd_version = "2.0beta1"
|
||||
|
||||
----
|
||||
-- Shortcuts (which user is supposed to be able to use them as well)
|
||||
@ -658,6 +658,7 @@ end
|
||||
|
||||
----
|
||||
-- Called by core when an overflow happened.
|
||||
--
|
||||
function default_overflow()
|
||||
log(ERROR, "--- OVERFLOW on inotify event queue ---")
|
||||
lsyncd.terminate(-1) -- TODO reset instead.
|
||||
@ -665,6 +666,13 @@ function default_overflow()
|
||||
end
|
||||
overflow = default_overflow
|
||||
|
||||
-----
|
||||
-- Spawns a child process using bash.
|
||||
--
|
||||
function shell(command, ...)
|
||||
return exec("/bin/sh", "-c", command, "/bin/sh", ...)
|
||||
end
|
||||
|
||||
--============================================================================
|
||||
-- lsyncd default settings
|
||||
--============================================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user