Posts: 71
Threads: 20
Joined: Feb 2014
Reputation:
0
OK.....so I am trying to automate a weekly backup of my home folder. I did try the built in backup option in LL, but simply do not like the tons of zip files created during backup. I really only want mirror copies of the home folder on my NAS.
I installed grsync to setup the backup......and the backup works fine. I then created a backup.sh file to run the grsync backup session, made it executable, and tested it......it works fine as well.
Now I tried to add the script to a crontab job......this is where it all fails. I cannot get the file to run at all. I have tried MANY options.....I have added the path to the script to crontab.....tried adding the path in the script.......tried copying the script to the /bin folder.......tried standing on one foot while patting my head. I simply cannot get the file to launch using crontab. I have spent a number of hours looking up the correct formatting on google to get this right and it still fails to run.
I also tried installing gnome-scheduler to do this in a gui and it fails to run as well. Soooooo, what in the world am I missing to get this function to run automagically????
Any help would be great......thanks.
Posts: 1,849
Threads: 21
Joined: Sep 2015
Reputation:
0
I'm not a CRON expert but....
If not executing, maybe a permissions issue??
Any error's when running?? May have to pipe it out to a txt file to see errors..
LL4.8 UEFI 64 bit ASUS E402W - AMD E2 (Quad) 1.5Ghz - 4GB - AMD Mullins Radeon R2
LL5.8 UEFI 64 bit Test UEFI Kangaroo (Mobile Desktop) - Atom X5-Z8500 1.44Ghz - 2GB - Intel HD Graphics
LL4.8 64 bit HP 6005- AMD Phenom II X2 - 8GB - AMD/ATI RS880 (HD4200)
LL3.8 32 bit Dell Inspiron Mini - Atom N270 1.6Ghz - 1GB - Intel Mobile 945GSE Express -- Shelved
BACK LL5.8 64 bit Dell Optiplex 160 (Thin) - Atom 230 1.6Ghz - 4GB-SiS 771/671 PCIE VGA - Print Server
Running Linux Lite since LL2.2
Posts: 71
Threads: 20
Joined: Feb 2014
Reputation:
0
Thanks for the replies......yes, I thought it might be a permissions things as well. I have a copy of backup.sh in a user folder with my user ownership and a copy in /usr/bin/ with root ownership. Neither one seem to run, yet I can double click either and it launches fine. All I seem to get in syslog for this line is this....
Dec 14 08:15:01 kenneth-OptiPlex-755 CRON[8245]: (root) CMD (/usr/bin/backup.sh)
Dec 14 08:15:01 kenneth-OptiPlex-755 CRON[8244]: (CRON) info (No MTA installed, discarding output)
I am not trying to mail anything, as the file should launch and I should see grsync start running when it hits the correct time. It looks like it is "trying" to run???? But nothing is happening.....maybe I am wrong here?
Posts: 71
Threads: 20
Joined: Feb 2014
Reputation:
0
12-14-2015, 04:55 PM
(This post was last modified: 12-14-2015, 04:56 PM by kjacobs.)
Thanks for the tip.....that at least got some info on what is going on......got this from the mail file:
Subject: Cron <root@kenneth-OptiPlex-755> DISPLAY=:0.0 /home/kenneth/bin/backup.sh # JOB_ID_3
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Message-Id: <20151214165201.DA4455E165B@kenneth-OptiPlex-755>
Date: Mon, 14 Dec 2015 08:52:01 -0800 (PST)
No protocol specified
(grsync:11062): Gtk-WARNING **: cannot open display: :0.0
Not sure what this means....LOL. Also tried it without the DISPLAY command......still did not start.
Subject: Cron <root@kenneth-OptiPlex-755> /home/kenneth/bin/backup.sh >/home/kenneth/bin/text.txt # JOB_ID_3
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Message-Id: <20151214164801.BDA305E165B@kenneth-OptiPlex-755>
Date: Mon, 14 Dec 2015 08:48:01 -0800 (PST)
(grsync:10646): Gtk-WARNING **: cannot open display:
Posts: 1,849
Threads: 21
Joined: Sep 2015
Reputation:
0
Quote:(grsync:11062): Gtk-WARNING **: cannot open display: :0.0
Looks like its trying to launch a GUI of sorts..???..??
http://askubuntu.com/questions/614387/gk...-display-0
Another thought.. isn't CRON (sh) shell based and terminal is BASH... Not sure if this is still the case/true...
But the script runs in terminal and fails in cron - I assume it fails from any shell window...
Maybe its trying to prompt for roots PW??
Something like..
http://stackoverflow.com/questions/22704...s-in-shell
Hope it helps point in the right direction...
LL4.8 UEFI 64 bit ASUS E402W - AMD E2 (Quad) 1.5Ghz - 4GB - AMD Mullins Radeon R2
LL5.8 UEFI 64 bit Test UEFI Kangaroo (Mobile Desktop) - Atom X5-Z8500 1.44Ghz - 2GB - Intel HD Graphics
LL4.8 64 bit HP 6005- AMD Phenom II X2 - 8GB - AMD/ATI RS880 (HD4200)
LL3.8 32 bit Dell Inspiron Mini - Atom N270 1.6Ghz - 1GB - Intel Mobile 945GSE Express -- Shelved
BACK LL5.8 64 bit Dell Optiplex 160 (Thin) - Atom 230 1.6Ghz - 4GB-SiS 771/671 PCIE VGA - Print Server
Running Linux Lite since LL2.2
Posts: 1,484
Threads: 96
Joined: Mar 2014
Reputation:
0
I'm just stabbing in the dark....
Grsync is a GUI version of rsync..
Maybe that is the Gtk-WARNING cannot open display
Maybe it's trying to output something GUI-wise but it is not running a gui..??
I'm probably not making sense...
Can you not try just rsync..??
Upgrades WIP 2.6 to 2.8 - (6 X 2.6 to 2.8 completed on: 20/02/16 All O.K )
Linux Lite 3.0 Humming on a ASRock N3070 Mobo ~ btrfs RAID 10 Install on 4 Disks
Computers Early days:
ZX Spectrum(1982) , HP-150 MS-DOS(1983) , Amstrad CPC464(1984) , BBC Micro B+64(1985) , My First PC HP-Vectra(1987)
Posts: 1,484
Threads: 96
Joined: Mar 2014
Reputation:
0
@firenice03
great minds, well hopefully great minds....
Upgrades WIP 2.6 to 2.8 - (6 X 2.6 to 2.8 completed on: 20/02/16 All O.K )
Linux Lite 3.0 Humming on a ASRock N3070 Mobo ~ btrfs RAID 10 Install on 4 Disks
Computers Early days:
ZX Spectrum(1982) , HP-150 MS-DOS(1983) , Amstrad CPC464(1984) , BBC Micro B+64(1985) , My First PC HP-Vectra(1987)
Posts: 1,849
Threads: 21
Joined: Sep 2015
Reputation:
0
(12-14-2015, 05:50 PM)Wirezfree link Wrote: @firenice03
great minds, well hopefully great minds....
Yours yes... Mine - I'm getting there 8) I'm good with "google"....
Yeah - looks like the App is trying to access the display.. This may help..??..
http://promberger.info/linux/2009/01/02/...y-problem/
LL4.8 UEFI 64 bit ASUS E402W - AMD E2 (Quad) 1.5Ghz - 4GB - AMD Mullins Radeon R2
LL5.8 UEFI 64 bit Test UEFI Kangaroo (Mobile Desktop) - Atom X5-Z8500 1.44Ghz - 2GB - Intel HD Graphics
LL4.8 64 bit HP 6005- AMD Phenom II X2 - 8GB - AMD/ATI RS880 (HD4200)
LL3.8 32 bit Dell Inspiron Mini - Atom N270 1.6Ghz - 1GB - Intel Mobile 945GSE Express -- Shelved
BACK LL5.8 64 bit Dell Optiplex 160 (Thin) - Atom 230 1.6Ghz - 4GB-SiS 771/671 PCIE VGA - Print Server
Running Linux Lite since LL2.2