Last active
September 7, 2020 11:06
-
-
Save a2ikm/e0ff1e8dc58b16b31b47 to your computer and use it in GitHub Desktop.
lsyncd + s3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | |
| } |
^ Agree with the above 2 comments.
Also, is there a reason that you aren't using || true at the end of onStartup and onMove?
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.
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
Why do you check if the file exists before deleting it? The file will not be there because it was deleted.