LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 09-06-2020, 06:17 PM   #1
alex4buba
Member
 
Registered: Jul 2020
Posts: 624

Rep: Reputation: Disabled
Backup not working - KDE Plasma 20.04


MY saga with backup continues...

I have this cron job, intended to run once daily and keep 7 versions, one per each day of the week

Code:
00 18 * * 0 rsync -r /home/alex/afolders/ /media/alex/Elements/sun/
00 18 * * 1 rsync -r /home/alex/afolders/ /media/alex/Elements/mon/
00 18 * * 2 rsync -r /home/alex/afolders/ /media/alex/Elements/tue/
00 18 * * 3 rsync -r /home/alex/afolders/ /media/alex/Elements/wed/
00 18 * * 4 rsync -r /home/alex/afolders/ /media/alex/Elements/thu/
00 18 * * 5 rsync -r /home/alex/afolders/ /media/alex/Elements/fri/
00 18 * * 6 rsync -r /home/alex/afolders/ /media/alex/Elements/sat/
Each line, runs when executed in terminal, but the job itself doesn't.

So, I tried to use the Task app in KDE. I setup one single task, just to try. Please see screen shots for my setup, theerror I get when I try to run it manually and the 3rd image showing directory structure - no rsync folder, so - where is it?

Hope someone will point out what is wrong here

Thanks
Alex
Attached Thumbnails
Click image for larger version

Name:	task.jpg
Views:	21
Size:	142.7 KB
ID:	34030   Click image for larger version

Name:	taskerror.jpg
Views:	14
Size:	45.7 KB
ID:	34031   Click image for larger version

Name:	myfolders.jpg
Views:	17
Size:	208.8 KB
ID:	34032  
 
Old 09-06-2020, 06:28 PM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by alex4buba View Post
MY saga with backup continues...

I have this cron job, intended to run once daily and keep 7 versions, one per each day of the week

Code:
00 18 * * 0 rsync -r /home/alex/afolders/ /media/alex/Elements/sun/
00 18 * * 1 rsync -r /home/alex/afolders/ /media/alex/Elements/mon/
00 18 * * 2 rsync -r /home/alex/afolders/ /media/alex/Elements/tue/
00 18 * * 3 rsync -r /home/alex/afolders/ /media/alex/Elements/wed/
00 18 * * 4 rsync -r /home/alex/afolders/ /media/alex/Elements/thu/
00 18 * * 5 rsync -r /home/alex/afolders/ /media/alex/Elements/fri/
00 18 * * 6 rsync -r /home/alex/afolders/ /media/alex/Elements/sat/
Each line, runs when executed in terminal, but the job itself doesn't.

So, I tried to use the Task app in KDE. I setup one single task, just to try. Please see screen shots for my setup, theerror I get when I try to run it manually and the 3rd image showing directory structure - no rsync folder, so - where is it?

Hope someone will point out what is wrong here

Thanks
Alex
You path is not set properly from cron a common mistake I seem to remember seeing all the time.

Code:
root@haswell:~# which rsync
/usr/bin/rsync
A line should be for my setup using your folder structure.

Code:
00 18 * * 0 /usr/bin/rsync -r /home/alex/afolders/ /media/alex/Elements/sun/
Edit: and now I look again this may be needed in it too, /home/alex/afolders/*. To ensure that everything under the /home/alex/afolders/ is synced.

Last edited by HappyTux; 09-06-2020 at 06:31 PM.
 
Old 09-06-2020, 06:50 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,738

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
HappyTux is correct. As mentioned in your other threads you need to set a PATH in your crontab or use absolute paths for all commands.
But
Quote:
and now I look again this may be needed in it too, /home/alex/afolders/*. To ensure that everything under the /home/alex/afolders/ is synced.
is not correct. The wild card is not needed to ensure everything under the source is synced. The -r option means recursive.
 
Old 09-06-2020, 06:53 PM   #4
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
You have the '/' after the source. /home/alex/afolders/ puts the backup into /media/alex/Elements/sun/afolders. The trailing slash makes a difference, as I've told you before. You want the contents of afolders copied, the individual files, not the directory itself. Remove that slash and see what happens.
 
Old 09-06-2020, 07:19 PM   #5
alex4buba
Member
 
Registered: Jul 2020
Posts: 624

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
HappyTux is correct. As mentioned in your other threads you need to set a PATH in your crontab or use absolute paths for all commands.
But
is not correct. The wild card is not needed to ensure everything under the source is synced. The -r option means recursive.
OK, I changed the cron job to look like this - just for today. I set the job at 9:45AM (Monday in Australia) to execute at 10:00 AM

Code:
00 18 * * 0 rsync -r /home/alex/afolders/ /media/alex/Elements/sun/
00 10 * * 1 /usr/bin/rsync rsync -r /home/alex/afolders/ /media/alex/Elements/mon/
00 18 * * 2 rsync -r /home/alex/afolders/ /media/alex/Elements/tue/
00 18 * * 3 rsync -r /home/alex/afolders/ /media/alex/Elements/wed/
00 18 * * 4 rsync -r /home/alex/afolders/ /media/alex/Elements/thu/
00 18 * * 5 rsync -r /home/alex/afolders/ /media/alex/Elements/fri/
00 18 * * 6 rsync -r /home/alex/afolders/ /media/alex/Elements/sat/
It did NOT execute. My target extrnal drive has all te folders empty : sun,mon,tue etc...

So, what else can I try?

Thaks again
Alex
 
Old 09-06-2020, 07:22 PM   #6
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by scasey View Post
HappyTux is correct. As mentioned in your other threads you need to set a PATH in your crontab or use absolute paths for all commands.
But
is not correct. The wild card is not needed to ensure everything under the source is synced. The -r option means recursive.
I was thinking that was what the -r was for. I was just thinking how I do it for similar, I like to make certain it is what I wanted done. Leaving no doubt that I want all the items in a directory copied to where I want them.
 
Old 09-06-2020, 07:43 PM   #7
alex4buba
Member
 
Registered: Jul 2020
Posts: 624

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by HappyTux View Post
I was thinking that was what the -r was for. I was just thinking how I do it for similar, I like to make certain it is what I wanted done. Leaving no doubt that I want all the items in a directory copied to where I want them.
I am a disciplined soldier, this is what I did for a Monday backup:

Code:
00 10 * * 1 /usr/bin/rsync rsync -r /home/alex/afolders/ /media/alex/Elements/mon/
Is this not right?

Thanks
 
Old 09-06-2020, 08:47 PM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,738

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
Quote:
Originally Posted by alex4buba View Post
I am a disciplined soldier, this is what I did for a Monday backup:

Code:
00 10 * * 1 /usr/bin/rsync rsync -r /home/alex/afolders/ /media/alex/Elements/mon/
Is this not right?

Thanks
No. that is not right.
Compare what you did to what HappyTux posted in #2. They are not the same.
 
Old 09-06-2020, 10:04 PM   #9
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by alex4buba View Post
I am a disciplined soldier, this is what I did for a Monday backup:

Code:
00 10 * * 1 /usr/bin/rsync rsync -r /home/alex/afolders/ /media/alex/Elements/mon/
Is this not right?

Thanks
In addition to what scasey has said it will fail with an option not found error for the rsync after the command /usr/bin/rsync. I would think so anyways. This will expect it to be the options being passed to the command. And now i think more about it there are no quotes around it to allow the passing of the -r too. It should be something like "/usr/bin/rsync -r" better off just using the /usr/bin/rsync with * on the items to be synced from the /home/alex/afolders/ part of it like I showed above. Then you are in no doubt at all what is going to be done with the command it will sync everything under that folder to the destination.
 
1 members found this post helpful.
Old 09-06-2020, 10:11 PM   #10
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Quote:
00 18 * * 0 rsync -r /home/alex/afolders/ /media/alex/Elements/sun/
00 10 * * 1 /usr/bin/rsync rsync -r /home/alex/afolders/ /media/alex/Elements/mon/
The second line cannot work. You cannot put the name of the executable twice back to back. Guaranteed to fail.

You have the same problem you started that long and painful thread with some time back. I'll bet dollars to donuts your files are in a subdirectory under sun, and mon, and so on. That trailing /, as in /home/alex/afolders/ guarantees that. It should be /home/alex/afolders - full stop. I've told you this many times, but if you want to use it, learn to look in the subdirectory underneath /media/alex/Elements/mon/, and the others. That mon subdirectory should have no files, just a subdirectory.
 
Old 09-06-2020, 10:25 PM   #11
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,738

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
Well, with no absolute path for rsync originally, the cron job probably wouldn’t work...
The “double rsync” would have errored, as stated...so still no target.

Do as suggested in #2.
 
1 members found this post helpful.
Old 09-06-2020, 10:56 PM   #12
alex4buba
Member
 
Registered: Jul 2020
Posts: 624

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sgosnell View Post
The second line cannot work. You cannot put the name of the executable twice back to back. Guaranteed to fail.

You have the same problem you started that long and painful thread with some time back. I'll bet dollars to donuts your files are in a subdirectory under sun, and mon, and so on. That trailing /, as in /home/alex/afolders/ guarantees that. It should be /home/alex/afolders - full stop. I've told you this many times, but if you want to use it, learn to look in the subdirectory underneath /media/alex/Elements/mon/, and the others. That mon subdirectory should have no files, just a subdirectory.
The backup worked ok following my correction, removing extra rsync... The "mon" folder has inside it all the sub-folders from the source as intended.

One other question, what happens if at the intended job is to start, but the machine has gone to sleep? Will the job start when I wake it up?

Thanks again
Alex
 
Old 09-06-2020, 11:05 PM   #13
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by alex4buba View Post
The backup worked ok following my correction, removing extra rsync... The "mon" folder has inside it all the sub-folders from the source as intended.

One other question, what happens if at the intended job is to start, but the machine has gone to sleep? Will the job start when I wake it up?

Thanks again
Alex
Nothing it waits until the next day to run, install anacron to get it working all the time when a machine wakes up.

Code:
root@haswell:~# apt show anacron
Package: anacron
Version: 2.3-28
Priority: optional
Section: admin
Maintainer: Debian QA Group <packages@qa.debian.org>
Installed-Size: 101 kB
Depends: debianutils (>= 1.7), lsb-base (>= 3.0-10), libc6 (>= 2.7)
Recommends: cron | cron-daemon, rsyslog | system-log-daemon
Suggests: default-mta | mail-transport-agent, powermgmt-base
Replaces: pe
Homepage: http://sourceforge.net/projects/anacron/
Tag: admin::automation, implemented-in::c, interface::daemon, role::program,
 scope::utility
Download-Size: 34.6 kB
APT-Sources: http://ftp.de.debian.org/debian buster/main amd64 Packages
Description: cron-like program that doesn't go by time
 Anacron (like "anac(h)ronistic") is a periodic command scheduler.  It
 executes commands at intervals specified in days.  Unlike cron, it
 does not assume that the system is running continuously.  It can
 therefore be used to control the execution of daily, weekly, and
 monthly jobs (or anything with a period of n days), on systems that
 don't run 24 hours a day.  When installed and configured properly,
 Anacron will make sure that the commands are run at the specified
 intervals as closely as machine uptime permits.
 .
 This package is pre-configured to execute the daily jobs of the
 Debian system.  You should install this program if your system isn't
 powered on 24 hours a day to make sure the maintenance jobs of other
 Debian packages are executed each day.
 
Old 09-06-2020, 11:12 PM   #14
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Quote:
One other question, what happens if at the intended job is to start, but the machine has gone to sleep?
It depends on what you mean by sleep. Exactly what is in the power manager configuration? It could just kill the display, suspend, hibernate, or something else. Sleep is an imprecise term here.
 
Old 09-06-2020, 11:38 PM   #15
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,738

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
We simply don’t let the backup ‘puter goto sleep...but again, we’re backing up a remote system.

anacron is the answer. Study the man page(s). Maybe start a new thread...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Solus Readies KDE Plasma Edition Testing ISO with Latest KDE Plasma 5.14 Desktop LXer Syndicated Linux News 0 10-25-2018 03:03 PM
LXer: KDE Plasma 5.13 Desktop Reaches End of Life, KDE Plasma 5.14 Arrives October 9 LXer Syndicated Linux News 0 09-15-2018 10:30 PM
LXer: KDE Plasma 5.6.4 Desktop Environment Launches with Plasma Discover Improvements LXer Syndicated Linux News 0 05-10-2016 07:15 PM
LXer: Sebastian Kügler: KDE's Plasma Mobile is running on Plasma 5 and Kubuntu LXer Syndicated Linux News 0 07-26-2015 01:48 AM
[SOLVED] Please tell me how to tell KDE to run plasma-desktop instead of plasma-netbook Kenny_Strawn Linux - Software 7 07-19-2010 07:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration