LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Possible Cron issue? If so where am I going wrong? (https://www.linuxquestions.org/questions/linux-newbie-8/possible-cron-issue-if-so-where-am-i-going-wrong-4175545611/)

NFI 06-17-2015 06:56 AM

Possible Cron issue? If so where am I going wrong?
 
My handle is NFI, and not by accident as far as Linux issues are concerned. I've been programming/working etc with DOS/Windows for almost 30 years as an IT professional. But Linux, who I've up til now had VERY limited exposure to, has passed me by largely. Until now.

I'm doing my best to read manuals, posts on forums such as this and others, but I still cannot get cron jobs to work, and it has me buggered as to why.

OS is Linux Ubuntu 14.04 LTS 64 Bit Server. All system updates and program updates have been/are installed. Running Gnome GUI.

I would imagine the answer will be quite simple to someone more used to the system than I.

I'm trying to backup a folder homes/david/desktop/Server to an external USB drive mounted in the /david/media folder

Try as I might, no backup program will work when cronned. Run it manually, it's fine. But once scheduled none work. So far I've tried Rsych, Deju Dup, Lucky Backup, Simple Backup, GRsynch and probably others I've forgotten.

I'm logged in as david with his password which has basically root priveledges without being root. Administrator privileges in "Windows" speak.

Please, what am I missing?

netnix99 06-17-2015 07:02 AM

Can you provide the output of your crontab?

Code:

crontab -l

NFI 06-17-2015 07:48 AM

root@Server:/home/david# crontab -l

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ luckybackup entries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 10 * * * env DISPLAY=:0 /usr/bin/luckybackup --silent --skip-critical /home/david/.luckyBackup/profiles/default.profile > /home/david/.luckyBackup/logs/default-LastCronLog.log 2>&1
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end of luckybackup entries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
root@Server:/home/david#

---------- Post added 06-17-15 at 10:49 PM ----------

david@Server:~$ crontab -l

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ luckybackup entries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 10 * * * env DISPLAY=:0 /usr/bin/luckybackup --silent --skip-critical /home/david/.luckyBackup/profiles/default.profile > /home/david/.luckyBackup/logs/default-LastCronLog.log 2>&1
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end of luckybackup entries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
david@Server:~$

jpollard 06-17-2015 07:56 AM

What is in the file /home/david/.luckyBackup/logs/default-LastCronLog.log

BTW, are you logged in at 10:47 when this thing tries to run?

suicidaleggroll 06-17-2015 09:47 AM

cron really isn't built for GUI applications, you should switch to a command line utility and remove that DISPLAY setting in your job. "rsync" is what 99.999% of people use for this type of task, I highly suggest using that instead (you mentioned rsynch, was that a typo? I've never heard of it).

Why are you trying to run the same job as two different users at the exact same time? That's going to lead to conflicts. Pick one.

There is no such thing as a regular user with root privileges in Linux. You can have sudo privileges, but that's different. The main difference is it requires your password to be entered, which means it can't be automated, unless you modify the sudoers entry to allow you to run that exact command without requiring a password.

As jpollard said, you're dumping the output of your command to a log file, so what is in the log file???

netnix99 06-17-2015 10:12 AM

Forgive me, because I am not familiar with the program you are using, but are your crontab entries generated by luckybackup? One of the "how-to" pictures displays a CRON-IT button, so I assume it generates the cron job and adds it to the crontab. I ask because I cannot think of a reason to 'need' your Display set to do a basic file copy. Looking at the luckybackup website, it appears you have the ability to create jobs in cron that would not require X capabilities (last 2 entries in the picture) by using simple command line syntax.
http://luckybackup.sourceforge.net/d...Line_usage.png

hat1208 06-17-2015 12:31 PM

Also when executing from the command line you are logged in with your user credentials and your profile has been processed. When you execute a crontab you are not logged in and your profile has not been processed. So you could have PATH issues or other execution issues because of not being logged in when the crontab is executed.

NFI 06-17-2015 05:47 PM

OK, thanks for the input. First, Rsynch is indeed a typo and was meant to be rsync. Yes, I was logged in at the time of 10:47 hoping to watch the cron job work, or at least if it failed see why.

heres's the contents of /home/david/.luckyBackup/logs/default-LastCronLog.log

I know WHY the seagate one failed, it wasn't connected, and that was intentional as the two backup drives (Backup and Seagate) are used alternatively on a daily basis so one will always fail.

============================================================================================
Task list check
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


* Checking if the task list is empty... done
* Checking if 2 connected tasks have been selected for execution... done
* Checking if no task is included... done
* Checking if 2 or more identical destination directories are declared
& 'Backup dir contents' is checked... done


** Task list looks ok... **

============================================================================================
Directories check
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Source & destination data check results
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Errors have been found
Please have a good look at the following messages

WARNING means that the task is NOT going to be performed
CRITICAL means that the task is going to be performed normally

If a directory is empty or does not exist,
there is a possibility that you 've forgotten to mount a partition/drive
or have just mistyped a path !!

BEWARE if a destination is empty or non-existent
and it is not the first time you perform the specific task(s)

Also have in mind that checks are not performed for remote data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[Ok] -> Server Backup - BackUp
Last execution time : Friday, 12 June 2015 11:18:53 AM AEDT (no errors)
Source directory : /home/david/Desktop/Server/
Destination directory : /media/david/Backup/
_____________________________________________________________________________________________
[WARNING] -> Server BackUp - seagate
Last execution time : not available
Source directory : /home/david/Desktop/Server/
Destination directory : /media/david/Seagate Backup Plus Drive/ is not mounted.

This task will be SKIPPED

_____________________________________________________________________________________________

netnix99 06-18-2015 08:01 AM

Was this ran manually, rather than from the cron job (since it appears to have been successful)? If so, do you have a copy of a log that failed via cron?


All times are GMT -5. The time now is 08:21 PM.