Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
IMO, 'a' is a better choice than 'r', because it includes 'r' but does more. Most people would, I believe, use -a as a matter of course for a backup, unless they had a special situation. For an explanation of -rlptgoD, run rsync --help in a terminal. Or read the manual by running "man rsync" in a terminal.
With -v, you could pipe the output to a log file, which you could read at your leisure and see if things were actually being done the way you want. With no pipe, it just goes to standard out, and does no harm. The -z option compresses the data (only during transmission, not on file write) for faster and more efficient operation. It's your choice, though, and just -r alone will work.
Comming from 30+ years of GUI, I tend to read the manuals online. Terminal mode is not my preffered option.
Anyway, when I used the -a initially, it did something wrong - it was copying into itself also the alexfolders folder... all over again. I find that -r is working OK.
Now, I feel that I am missing something, here are the steps I did:
Created the scrip file call anajob and placed it inside the /tc folder
Ran the command inside that folder : sudo chmod 755 anajob
It executed and got back to the prompt.
Now, I am unclear as to what should I do with this:
--log-file=FILE log what we're doing to the specified FILE
Is probably the best for doing a log. My favourite options for the command.
MacUser2525:~$ alias rs
alias rs='rsync -avP'
There are many ways to do it, and rsync provides many more choices. That's why it's important to read the man pages and see what you want/need, and what you don't. There is a learning curve, but it's worth riding that curve.
Using -a instead of -r was not the cause of copying to the wrong place. Neither changes the destination at all.
If you want to read the man pages online, that's perfectly fine. All the man pages for almost every package are available. https://www.man7.org/linux/man-pages/ https://www.linux.org/docs/index.html
Reading may make posting questions unnecessary, and will certainly enable posting more directed questions.
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
1 10 my-backups /path/to/my_backup_script
An as an example this is the default anacrontab from CentOS 7. You would add your line after the last line in that file as illustrated above.
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
1 10 my-backups /path/to/my_backup_script
An as an example this is the default anacrontab from CentOS 7. You would add your line after the last line in that file as illustrated above.
OK, my anacrontab file looks now like this:
Code:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root
# These replace cron's entries
1 10 my-backups /etc/anajob
It will run everyday 10 minutes after the computer starts. Not to add to the confusion but when the job runs if the computer is already on depends on how anacron which is usually by cron. If no start_hours_range is defined it could be anytime.
It will run everyday 10 minutes after the computer starts. Not to add to the confusion but when the job runs if the computer is already on depends on how anacron which is usually by cron. If no start_hours_range is defined it could be anytime.
Sorry, not clear - I thought it will run within 10 minutes from when I turn it on, once per day!
I have the machine on for 10-11 hours each day.
Are you telling me that it will run during that entire time every 10 minutes? I sure hope that's not the case.
I don't really care when during the day it runs, as long as it is sometime during those 11 hours.
BTW, it executed OK today shortly afte I modified the anacrontab file
OK, I am relaxed now.
I also noticed that using the -r flag, is showing the file time stamps of the time the backup was executed, which is NOT a good idea. I am going to replace it with -a, to preserve the file time stamp, as suggest at first by sgonsell
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.