ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If rsync is not allowed to be part of the solution, then the solution will probably be sub-optimal. Ergo, what are the bounds within which a solution is deemed acceptable? Taking the literal meaning of your requirements: 'simple bash tools' would mean using only bash built-in commands, which leaves a quite sparse universe of available tools.
In summary, you need to think about the problem and describe what you are really trying to do. I'm smelling homework here, when the optimal and simple answer cannot be part of the solution.
Why not just install rsync to a place that doesn't require root privileges? If you're making backups, you must have enough disk quota to accommodate that. Otherwise, just delete all of the backup files, and re-copy the source to the backup destination? Does the backup have to be accessible as part of the filesystem, or can it be a data blob like a tarball, or cpio archive?
Not all binaries are transportable in that way. The versions various libraries may not satisfy the linking loader. It should be true that any identical or very similar installations can run copies of the same binary.
Geeks aren't generally interested in developing things that have already been done, unless they can raise the bar somehow. Writing, in bash, an application that already exists is unlikely to fit that description.
--- rod.
Why are you using BusyBox? If the goal is to "using simple bash tools (actually linux sys tools such as cp and cpio)"
and BB doesn't have rsync, then I'd RUN to find an alternative to busybox. Even a broke watch is right twice a day.
Quote:
the aim would be to achieve a backup with deleting the files on the destination that are not anymore on the source.
source what? Busybox seems to be a linux binary program.
No mention of tar...? Curious.
BB includes that.
Statements like "I cannot hack the root to install a rsync." don't help. Hack what root? Who's root?
It is amazing that people are so curious, trying to help, and do not stick what is aimed. (please do not take it personally)
The first post is indeed confusing, and can trigger lot of questions. I can definitely understand. This is human.
You find then an example to make it simple, and though they ask thousand questions why not to install rsync or install a debian that has rsync.
I have of course all permissions.
Let's give additional info; this might be easier to understand:
CPIO can be used to backup but it misses the "--delete" option. It creates well the new directories, but to sync it and delete the non-present files in target if there arent anymore in the source dir? For that you need to do it by hand. So why bash? Because you can use it almost everywhere. Some people are traveling, using different machines, ... and portability can sometimes be needed. Some people have not necessarily to seat daily in front of the same computer all their life. So "portability" (script portability) can be an issue for some people.
Quote:
Geeks aren't generally interested in developing things that have already been done, unless they can raise the bar somehow. Writing, in bash, an application that already exists is unlikely to fit that description.
Geeks or hackers do not necessarily use what already exists. If they are making a worm, they code it themselves. If they are sufficiently good enough and skilled, they rather like to use their own program, if they have the time and if needed/preferred. Geeks and hackers are often pioneers in some areas. So mostly they gotta code their own programs in most cases, or to be lucky that a project already exists (GIT,...) and then join it.
Since everyone is different, some rather use what exists other use their own tools.
The aim of this thread is to come to a bash script that can be an alternative to rsync for simple copy/move operations over a mounted sshfs/nfs/samba... It can of course be done on any platforms or machines since cpio is mostly everywhere. Rsync not.
I see that I will not get any reply here on Linuxquestions. I should google on bash forums.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.