Skip to content

Instantly share code, notes, and snippets.

@a2ikm
Last active September 7, 2020 11:06
Show Gist options
  • Save a2ikm/e0ff1e8dc58b16b31b47 to your computer and use it in GitHub Desktop.
Save a2ikm/e0ff1e8dc58b16b31b47 to your computer and use it in GitHub Desktop.
lsyncd + s3
s3sync = {
maxProcesses = 1,
onStartup = "aws s3 sync ^source ^target",
onCreate = "[ -f ^source^pathname ] && aws s3 cp ^source^pathname ^target^pathname || true",
onModify = "[ -f ^source^pathname ] && aws s3 cp ^source^pathname ^target^pathname || true",
onDelete = "[ -f ^source^pathname ] && aws s3 rm ^target^pathname || true",
onMove = "aws s3 mv ^target^o.pathname ^target^d.pathname",
}
sync {
s3sync,
source = "/path/to/source",
target = "s3://your-bucket-name/path/to/target",
}
@tdmalone
Copy link

Oh actually, from my reading of the docs, || true might not be needed at all? (except for onStartup, if that's what you want):

By default Lsyncd ignores all exit codes except onStartup which must return 0 for it to continue.

@strowi
Copy link

strowi commented Sep 7, 2020

fyi, there has been a documentation update with example: lsyncd/lsyncd#463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment