cyberluna

joined 5 months ago
[–] [email protected] 2 points 5 months ago

Cool! Have fun! Good to know. If you tried it and would like to share some feedback that would be nice

[–] [email protected] 2 points 5 months ago

Thx! Glad it made sense to you

[–] [email protected] 1 points 5 months ago

You're welcome! Thx! Glad you found it interesting!

[–] [email protected] 2 points 5 months ago (2 children)

Thanks for asking!

You could check out this thread for the main different features in lunas, and an overview of the syncing algo

https://programming.dev/comment/9461693

[–] [email protected] 2 points 5 months ago

You could check out this thread for the main different features in lunas, and an overview of the syncing algo

https://programming.dev/comment/9461693

[–] [email protected] 2 points 5 months ago

I have no idea, i don't know unison

You could check out this thread tho if you want,

https://programming.dev/comment/9461693

[–] [email protected] 1 points 5 months ago

I took a look at their docs https://docs.syncthing.net/v1.27.5/users/foldertypes

And it seems similar

Src/send-only -> send files to other dest/receive-only

Dest/recieve-only -> doesn't send any file modifications or new files to other directories

Src+dest/normal -> send files to other dest and receives files from other srcs

With the option -D/-diff enabled file modifications can be synced, with newer files replacing older files

[–] [email protected] 3 points 5 months ago
 

cross-posted from: https://programming.dev/post/13156830

https://codeberg.org/cyber-luna/lunas

Archlinux: yay -S lunas

i made a versatile syncing cli program, lunas, that's capable of syncing local to local, local to remote, remote to local and remote to remote at the same time with many input directories, with their file attributes if enabled and more. It syncs both ways but it has src/dest options that can be assigned to individual input directories

it runs locally, unless remote syncing is used then it runs peer-to-peer using libssh/sftp

It can do sync removal between different input directories, meaning if u want to remove a file/directory that you don't want to sync back to other directories, you can "lunas -rm file" for local or "lunas -rrm user@ip:/path/to/dir" for remote and then use the option "-cr Y" while syncing to remove it from every other directories, or simply don't use this option and it should be ignored without removal, or "-cr S" and it should be synced back to the directory it was removed from, IF it was found in one of the other directories

it has an optional config file for defining presets for easier syncing instead of writing them each time in the cli

there are more options to it which can be found in the --help or in the man page for more details

a simple usage of lunas can be like this

lunas -p dir1 -p dir2 --dry-run

lunas -s dir1 -d dir2 -d dir3 -rd user@ip:dir4

lunas -r user@ip:dir1 -d dir2 -dr

lunas -rs user@ip:dir1 -d dir2 -cr Y

lunas -rd user@ip:dir1 -s dir2

lunas -p dir1 -p dir2 -p dir3 -p user@ip:dir4 -p user@ip:dir5

p: local path r: remote path , both of them are source and destination

s: source local path d: destination local path

rs: source remote path rd: destination remote path

-dr/--dry-run: outputs what would be synced without actually syncing them

-cr/--confirm-remove Y: confirms the sync removal as explained previously

 

cross-posted from: https://programming.dev/post/13156830

https://codeberg.org/cyber-luna/lunas

Archlinux: yay -S lunas

i made a versatile syncing cli program, lunas, that's capable of syncing local to local, local to remote, remote to local and remote to remote at the same time with many input directories, with their file attributes if enabled and more. It syncs both ways but it has src/dest options that can be assigned to individual input directories

it runs locally, unless remote syncing is used then it runs peer-to-peer using libssh/sftp

It can do sync removal between different input directories, meaning if u want to remove a file/directory that you don't want to sync back to other directories, you can "lunas -rm file" for local or "lunas -rrm user@ip:/path/to/dir" for remote and then use the option "-cr Y" while syncing to remove it from every other directories, or simply don't use this option and it should be ignored without removal, or "-cr S" and it should be synced back to the directory it was removed from, IF it was found in one of the other directories

it has an optional config file for defining presets for easier syncing instead of writing them each time in the cli

there are more options to it which can be found in the --help or in the man page for more details

a simple usage of lunas can be like this

lunas -p dir1 -p dir2 --dry-run

lunas -s dir1 -d dir2 -d dir3 -rd user@ip:dir4

lunas -r user@ip:dir1 -d dir2 -dr

lunas -rs user@ip:dir1 -d dir2 -cr Y

lunas -rd user@ip:dir1 -s dir2

lunas -p dir1 -p dir2 -p dir3 -p user@ip:dir4 -p user@ip:dir5

p: local path r: remote path , both of them are source and destination

s: source local path d: destination local path

rs: source remote path rd: destination remote path

-dr/--dry-run: outputs what would be synced without actually syncing them

-cr/--confirm-remove Y: confirms the sync removal as explained previously

[–] [email protected] 4 points 5 months ago

i'm not very knowledgeable with features of syncthing, but it's not exactly similar to syncthing. syncthing works well if you want a daemon working in the background checking for new added files, and then syncing them to remote

lunas doesn't have a daemon, maybe in the future that could be added idk.

idk if syncthing can sync file attributes and handle dereferencing symlink and checking for broken links, but lunas can do that

also lunas is a small 620K cli binary unlike syncthing which is a big 23M gui program

syncthing is more cross-platform than lunas. lunas works on Android tho, but inside Termux

but syncthing isn't good at local syncing as mentioned in their docs https://docs.syncthing.net/users/faq.html#does-syncthing-support-syncing-between-folders-on-the-same-system

lunas can do local syncing very well

[–] [email protected] 4 points 5 months ago

quick overview of the syncing algo

  • a simple overview

1- list all input directories content first

2- a table is made as a map, the rows are the files/dirs, the column numbers are the input directories in a specific order, what's inside each cell of each row, is the mtime, modification time, of that file in different input directory if -diff option was used

3- and it loops through the table to check what is a SRC AND has a newer mtime than another DEST, if so, it removes the dest and resyncs it

without the option -diff what gets filled in the cells of each row are true/false of whether that file exist in this input directory or not. and it just sync based on file name, and which SRC dir it detects first that would be the src of what is missing in the DEST

the ordering of the input directories in the table's columns, are as the user input them, but the local ones has a priority, they get listed first in these columns

so, the conflicts with the -diff option is resolve based on newer/older mtime and src/dest and the newer src updates the older dest. without it just based on file names which is more random, as explained

  • a more techincal overview

1- list all input directories content first

2- in each input directory listing, add the content to vector A 'all_content', the type to vector B 'types', the input_dir_number of the file to vector C 'track_existence', and if option -diff is enabled, push the mtime to vector D 'track_existence_mtime'

i'm gonna explain with the option -diff first which let's it check for mtime, modification time, difference between files and sync based on that

-diff option enables '--attributes mtime' by default which makes sure if re-run it only resync the files if they were changed

'--mtime off' can be used as mentioned in the man page to avoid syncing the mtime

3- the all_content gets sorted using quick sort, and the other vectors follow its sorting order

4- a 2D vector/a table is made as an existence map, the rows are the files/dirs, the column numbers are the input directories in a specific order, what's inside each cell of each row, is the mtime of that file in different input directory

5- the track_existence vector should be cleared after that

6- and it loops through the 2D vector to check what is a SRC AND has a newer mtime than another DEST, if so, it removes the dest and resyncs it

without the option -diff the vector D 'track_existence_mtime' don't get filled, and what gets filled in the cells of each row are true/false of whether that file exist in this input directory or not. and it just sync based on file name, and which SRC dir it detects first that would be the src of what is missing in the DEST

the ordering of the input directories in the existence map columns, are as the user input them, but the local ones has a priority they get listed first in these columns

so, the conflicts with the -diff option is resolved based on newer/older mtime and src/dest and the newer src updates the older dest. without it just based on file names which is more random, as explained

in the copying, or filesystem in general, functions, C++ provide methods to check if certain operations were faulty or not, i use these methods combined with checking the return of remote reading/writing if successful or not, if a write or read to a buffer produced an error, syncing to that file stops and it goes to the next file. that file stays named as file.ls.part

lunas doesn't have checksum option, not yet at least i might add it later. so if that is a problem for someone, they could avoid using lunas for now

but i made a seperate program that checks recursively checksums of many input directories which i usually use when needed to check if lunas is working correctly or not

btw just to be clear, as mentioned in the license, --> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more details. -> https://www.gnu.org/licenses/gpl-3.0.en.html

[–] [email protected] 6 points 5 months ago (2 children)

thx! i learned some markdown and edited my reply. Does it look good now?

[–] [email protected] 7 points 5 months ago

multi directory syncing with src and/or dest for each input directory. u can sync as many directories, locally and remotely, ig as your ram can handle

u could read more about it in this reply

https://programming.dev/comment/9461693

 

cross-posted from: https://programming.dev/post/13156830

https://codeberg.org/cyber-luna/lunas

Archlinux: yay -S lunas

i made a versatile syncing cli program, lunas, that's capable of syncing local to local, local to remote, remote to local and remote to remote at the same time with many input directories, with their file attributes if enabled and more. It syncs both ways but it has src/dest options that can be assigned to individual input directories

it runs locally, unless remote syncing is used then it runs peer-to-peer using libssh/sftp

It can do sync removal between different input directories, meaning if u want to remove a file/directory that you don't want to sync back to other directories, you can "lunas -rm file" for local or "lunas -rrm user@ip:/path/to/dir" for remote and then use the option "-cr Y" while syncing to remove it from every other directories, or simply don't use this option and it should be ignored without removal, or "-cr S" and it should be synced back to the directory it was removed from, IF it was found in one of the other directories

it has an optional config file for defining presets for easier syncing instead of writing them each time in the cli

there are more options to it which can be found in the --help or in the man page for more details

a simple usage of lunas can be like this

lunas -p dir1 -p dir2 --dry-run

lunas -s dir1 -d dir2 -d dir3 -rd user@ip:dir4

lunas -r user@ip:dir1 -d dir2 -dr

lunas -rs user@ip:dir1 -d dir2 -cr Y

lunas -rd user@ip:dir1 -s dir2

lunas -p dir1 -p dir2 -p dir3 -p user@ip:dir4 -p user@ip:dir5

p: local path r: remote path , both of them are source and destination

s: source local path d: destination local path

rs: source remote path rd: destination remote path

-dr/--dry-run: outputs what would be synced without actually syncing them

-cr/--confirm-remove Y: confirms the sync removal as explained previously

 

https://codeberg.org/cyber-luna/lunas

Archlinux: yay -S lunas

i made a versatile syncing cli program, lunas, that's capable of syncing local to local, local to remote, remote to local and remote to remote at the same time with many input directories, with their file attributes if enabled and more. It syncs both ways but it has src/dest options that can be assigned to individual input directories

it runs locally, unless remote syncing is used then it runs peer-to-peer using libssh/sftp

It can do sync removal between different input directories, meaning if u want to remove a file/directory that you don't want to sync back to other directories, you can "lunas -rm file" for local or "lunas -rrm user@ip:/path/to/dir" for remote and then use the option "-cr Y" while syncing to remove it from every other directories, or simply don't use this option and it should be ignored without removal, or "-cr S" and it should be synced back to the directory it was removed from, IF it was found in one of the other directories

it has an optional config file for defining presets for easier syncing instead of writing them each time in the cli

there are more options to it which can be found in the --help or in the man page for more details

a simple usage of lunas can be like this

lunas -p dir1 -p dir2 --dry-run

lunas -s dir1 -d dir2 -d dir3 -rd user@ip:dir4

lunas -r user@ip:dir1 -d dir2 -dr

lunas -rs user@ip:dir1 -d dir2 -cr Y

lunas -rd user@ip:dir1 -s dir2

lunas -p dir1 -p dir2 -p dir3 -p user@ip:dir4 -p user@ip:dir5

p: local path r: remote path , both of them are source and destination

s: source local path d: destination local path

rs: source remote path rd: destination remote path

-dr/--dry-run: outputs what would be synced without actually syncing them

-cr/--confirm-remove Y: confirms the sync removal as explained previously

view more: next ›