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.
It's not about being a newbie, it's about you making some effort to understand what you're being told.
We shouldn't have to spoon feed you.
command means your rsync command
>file1 means the file to capture the stdout
2>file2 means the file to capture the stderr
I don't see how that could be put any clearer, unless we simply type your commands for you. You'll learn better if you figure it out yourself.
Remember that the /full/path/to/file1 (the "absolute path") needs to be specified because you're working on a cron job.
We are of a similar age. Yes, I have been programming computers for a very long time (> 40 years), but I've always avoided calling myself an "expert," even when I was the resident expert.
The way to learn how to use Linux (or anything) is to learn how to look up how.
On Linux, that's the man pages, which are available online if you aren't comfortable reading them in a terminal. Simply put man command into your favorite search engine and you'll get several links to online copies of the documentation.
You need to answer the specific questions you've been asked. Show us the ls -l of the source and destination files that you think should be the same but aren't.
You should be getting a summary, either in the log files you're creating or in the emails being sent to root.
Dear helper,
Our current age is not really important, what is however is at the time of being that age, how long ago you started with it, compared to how long ago I did. It will not be possible for you to recal your situation at the start, nor how much spoon feeding you needed.
I read manuals, recently between 4-6 hours a day. The amount of information presented is an up-heel journey for me, so if I don't manage to absorb the pile of new things and I keep asking stupid questions, should IMO be forgiven.
The terms used here frquently, are cleared to the writer, not to a newbie.
What is the command "touch" doing, what is "stdout" doing? I can continue with the list but you get my point. Every response I received here, required that I go and Google the terms and even then, in many cases I have probably got it wrong.
Fair enough.
The touch command will create a file if it doesn’t exist or update the timestamp of one if it does.
We’re suggesting it to cause the destination device to “spin up” so it’s available to the rsync command.
The sleep command is to give it time to get to speed before the rsync command starts.
The -s option should be outputting a summary. The redirection should put that in the specified files.
Fair enough.
The touch command will create a file if it doesn’t exist or update the timestamp of one if it does.
We’re suggesting it to cause the destination device to “spin up” so it’s available to the rsync command.
The sleep command is to give it time to get to speed before the rsync command starts.
The -s option should be outputting a summary. The redirection should put that in the specified files.
OK, I ran the following command in terminal : sudo fdisk -l
I got a list of all the partitions I have in this machine, BUT when I look in my File manager - Dolphin, The external drive still shows as not mounted.
#!/bin/bash
#get day of week
dow=$(/usr/bin/date "+%a")
# convert DOW to lower case i.e. Mon to mon
ldow=${dow,,}
/usr/bin/rsync -av /home/alex/afolders/ /media/alex/Elements/$ldow/ >> /tmp/rsync.log
change it to
Code:
#!/bin/bash
#get day of week
dow=$(/usr/bin/date "+%a")
# convert DOW to lower case i.e. Mon to mon
ldow=${dow,,}
/usr/bin/rsync -av /home/alex/afolders/ /media/alex/Elements/$ldow/ &>> /tmp/rsync.log
or
Code:
#!/bin/bash
#get day of week
dow=$(/usr/bin/date "+%a")
# convert DOW to lower case i.e. Mon to mon
ldow=${dow,,}
/usr/bin/rsync -av /home/alex/afolders/ /media/alex/Elements/$ldow/ >> /tmp/rsync.log 2>/tmp/rsync.err
and examine the log (or log and err) file after the next run.
#!/bin/bash
#get day of week
dow=$(/usr/bin/date "+%a")
# convert DOW to lower case i.e. Mon to mon
ldow=${dow,,}
/usr/bin/rsync -av /home/alex/afolders/ /media/alex/Elements/$ldow/ >> /tmp/rsync.log
change it to
Code:
#!/bin/bash
#get day of week
dow=$(/usr/bin/date "+%a")
# convert DOW to lower case i.e. Mon to mon
ldow=${dow,,}
/usr/bin/rsync -av /home/alex/afolders/ /media/alex/Elements/$ldow/ &>> /tmp/rsync.log
or
Code:
#!/bin/bash
#get day of week
dow=$(/usr/bin/date "+%a")
# convert DOW to lower case i.e. Mon to mon
ldow=${dow,,}
/usr/bin/rsync -av /home/alex/afolders/ /media/alex/Elements/$ldow/ >> /tmp/rsync.log 2>/tmp/rsync.err
and examine the log (or log and err) file after the next run.
OK, I replaced the last line in the job with what you gave me:
#!/bin/bash
#get day of week
dow=$(/usr/bin/date "+%a")
# convert DOW to lower case i.e. Mon to mon
ldow=${dow,,}
/usr/bin/rsync -av /home/alex/afolders/ /media/alex/Elements/$ldow/ 2>&1 |tee -a /tmp/rsync.log
and watch it run manually.
This should show AND LOG the output with error information.
Could you have scheduled this in such a way that it does not have permission to write into the /tmp folder?
For that matter, what are the permissions on your script?
How have you scheduled the run of this script?
Does that rsync.log file exist and have global read/write permissions?
I would check all of these at this point, just to cover all of the obvious bases.
PS: that the desktop is KDE is pretty much irrelevant. Scripts generally run below the level of the GUI applications when scheduled.
#!/bin/bash
#get day of week
dow=$(/usr/bin/date "+%a")
# convert DOW to lower case i.e. Mon to mon
ldow=${dow,,}
/usr/bin/rsync -av /home/alex/afolders/ /media/alex/Elements/$ldow/ 2>&1 |tee -a /tmp/rsync.log
and watch it run manually.
This should show AND LOG the output with error information.
Could you have scheduled this in such a way that it does not have permission to write into the /tmp folder?
For that matter, what are the permissions on your script?
How have you scheduled the run of this script?
Does that rsync.log file exist and have global read/write permissions?
I would check all of these at this point, just to cover all of the obvious bases.
PS: that the desktop is KDE is pretty much irrelevant. Scripts generally run below the level of the GUI applications when scheduled.
You see, because at this stage of my learning, I have no idea what matters and what not, I make a point to specify my environment, just in case.
When the instruction I had was the following, the log file was created, not it is NOT:
Is the log file the only thing that is not working? The files are synced over?
If it is just a log file issue, take another look at my script. There is a line that first looks for a log folder, if not there it creates one. You may wish to do something like that and not use the /tmp folder. I know some distros will flush the /tmp folder after X amount of time. Found that out the hard way years back... Lost a fair amount of data. My bad. Now I just never use /tmp.
what is the output when you run the script with
Code:
bash -xvv
this will produce a very verbose output on the screen as the code runs.
Whatever you do, make sure that your logs expire, or you configure that log for logrotate, or that you manually purge them when they are no longer needed. Otherwise your log file can grow to fill your drive and crash your OS.
Whatever you do, make sure that your logs expire, or you configure that log for logrotate, or that you manually purge them when they are no longer needed. Otherwise your log file can grow to fill your drive and crash your OS.
I suppose if you never reboot it would be possible, but by design /tmp is cleared on every boot or reboot of the system. As with everything in linux pretty much, you can disable that setting. In addition as was suggested above, adding a file/directory check to the script, this could be done so that every time the script runs it would delete any previous files created.
I suppose if you never reboot it would be possible, but by design /tmp is cleared on every boot or reboot of the system. As with everything in linux pretty much, you can disable that setting. In addition as was suggested above, adding a file/directory check to the script, this could be done so that every time the script runs it would delete any previous files created.
I turn OFF my machine each night when going to sleep and turn it ON again the next morening.
If I understand correctly, the next time the job runs it will overright the previos rsync.log
Sorry, not clear. Why do I need to keep it? Why should it not be overridden?
The point of log files is to keep track of useful information and when something goes wrong you read them to figure out what went wrong and how fix it.
If you don't want to be able to do that then by all means continue to generate a log file that gets wiped out every day.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.