[SOLVED] Wouldn't a systemctl service be better suited for this kind of thing vs a cron job?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Not trying to be an ass but this needs to be said.
Google. Seriously. It got me switched from cron > systemd timers fairly quickly. It's surprisingly easy thing to get hold of. Once you have a template just modify it as needed. I have made several services with varying times using the first timer file I made as a template. Search systemd timers
I duckduckgo but I will for sure take you up on your advice and search and search some more, you've given me some homework it seems
Stop doing "rm -r backupdir" followed by "cp -R sourcedir backupdir" and instead use rsync with --delete (and whatever other options are needed), and then:
1) you don't need to deal with two tasks.
2) you're not wasting time deleting files that are about to get re-created.
Stop doing "rm -r backupdir" followed by "cp -R sourcedir backupdir" and instead use rsync with --delete (and whatever other options are needed), and then:
1) you don't need to deal with two tasks.
2) you're not wasting time deleting files that are about to get re-created.
Which one is it , is it the --delete-after or --delete-before switch ? And also did I even get the right commands ? This is the first time I am using rsync and I don't want to end up deleting the source directory, rather I want to delete the directory in /media/tuxthegreat/Backup/transmission so it can replace the dir from thesource dir? AM I in the right track guys ?
Which part of my post suggests using --delete-after or --delete-before ?
As MadeInGermany said, the latter is closer to what you're doing already, but it is unnecessary unless space is limited. (If space is limited, get a bigger backup device.)
If you're unfamiliar with rsync, read the example usage. As you'll see, the -a (--archive) option is used frequently, as is -v (--verbose), and - as with any destructive action - doing a dry-run is a really good idea.
Quote:
Originally Posted by man rsync
--dry-run, -n
This makes rsync perform a trial run that doesn't make any changes (and produces mostly the same output as a real run). It is most commonly used in combination with the --verbose (-v) and/or --itemize-changes (-i) options to see what an rsync command is going to do before one actually runs it.
Additionally, creating a copy of the destination folder and testing independently (whilst keeping your existing tasks in place) might make sense.
Which part of my post suggests using --delete-after or --delete-before ?
As MadeInGermany said, the latter is closer to what you're doing already, but it is unnecessary unless space is limited. (If space is limited, get a bigger backup device.)
If you're unfamiliar with rsync, read the example usage. As you'll see, the -a (--archive) option is used frequently, as is -v (--verbose), and - as with any destructive action - doing a dry-run is a really good idea.
Additionally, creating a copy of the destination folder and testing independently (whilst keeping your existing tasks in place) might make sense.
Ok I understand where you are going with this, I need to man rsync and start reading up on it. Rome wasn't built in a day and neither will my Debian 12. I have plenty of storge space, 200TB in raid6 and counting for my movie and music collection but that's another thread. I will look into rsync and I will post back my results on what I have learned, I wll mark this thread as Solved for the time being but I will post my results on it in case you are still interested in what if anything I have accomplished. So thank you for your time and patience, I know it is a virtue that is needed when it comes to me and Linux Anyway back to the drawing board. Wish me luck.
As a user you can chose a distro that avoids systemd - like Devuan.
Other distros, other policies.
E.g. RedHat(and CentOS,Rocky,Alma) goes for systemd but still prefers chrony to systemd-timesyncd and nmcli/nmtui to systemd-networkd.
As a user you can chose a distro that avoids systemd - like Devuan.
Other distros, other policies.
E.g. RedHat(and CentOS,Rocky,Alma) goes for systemd but still prefers chrony to systemd-timesyncd and nmcli/nmtui to systemd-networkd.
Actually recently I got some free time saved up ( a couple of weeks ) and I have decided to bite the bullet and make my own *distro* and I will start with LFS *Linux From Scratch* I will start off with a stage 3 tarball and see where it takes me from there. I have 100% complete control over what goes where and I can avoid systemd altogether. What do you think @MadeInGermany, do you think that it would be a wise move and how hard do you think this venture would be for someone who has been using Linux from Ubuntu 6.06LTS, I know how to compile a kernel, how to add modules to it, I know how to compile my own software with some success. And I have more than one computers around me so I can prepare the LFS on one computer while I DDG answers on another one and bug you guys if it comes to that. I don't need some sophisticated workstation, I need it to have 2 browsers, Firefox and a second one, perhaps konqueror browser, see this shows the direction I am headed in, a KDE build, how hard would that be compared to a LFS Mate desktop ? Any pointers are welcome, I am just so sick of these issues that pop up that I have to ask help for because I didn't compile it so I don't know the inner workings for the software in question. I want to keep it KISS ( keep it stupid simple ) I also need a music player that plays FLAC cause I have a huge collection of FLAC music, I need it to have a Kodi media center and I need it to be able to mount inner HDDs cause I have a lot of those in m oversized tower. The computer in my signature is not the one I will be building the LFS on, I will be building it on another i9 9900KS rig that has a Nvidia card. So what do you think, go or no go ? I can always try and give up if it gets too hard, but I am a stubborn man who doesn't give up the second something doesn't go his way.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.