Author Topic: Cron Job for SpiderOak [SOLVED]  (Read 4685 times)

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Cron Job for SpiderOak [SOLVED]
« on: November 01, 2014, 05:30:45 am »
Hi, I am fed up with my SpiderOak backup eating up memory.  I only need it to backup once a day and then I can turn it off and on manually as needed.  A Cron Job at 18:00, (my dinner time  :P) everyday is an ideal solution.  I've made a Shell Script as ROOT:
Code: [Select]
/usr/bin/SpiderOak-Cronjob.shContents:
Code: [Select]
#!/bin/bash
#SpiderOak Cron Job
SpiderOak
echo "Starting SpiderOak Cron Job"

This has been made executable with:
Code: [Select]
chmod 755 SpiderOak-Cronjob.sh Tested with
Code: [Select]
./SpiderOak-Cronjob.shThis starts.

I've made a Crontab table as ROOT:
Spoiler (click here to view / hide)
[close]
Saved it and checked it with:
Code: [Select]
contab -lIt is there. The time of 12:47 was for test purposes only.  12:47 came and went and the Cron Job didn't start.  This is the first time I've tried to set up one of these and I have no idea what I'm doing wrong  :-\.  Any help would be much appreciated - thanks  ;).
« Last Edit: November 01, 2014, 05:23:06 pm by AndyInMokum »
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Cronjob for SpiderOak
« Reply #1 on: November 01, 2014, 06:18:10 am »
What's the output from:
Code: [Select]
crontab -land
Code: [Select]
sudo crontab -land
Code: [Select]
ls -l /usr/bin/SpiderOak-Cronjob.shand out of interest, what does the command:
Code: [Select]
SpiderOakactually do ? .. and does it need to be run with root privileges ?



[EDIT]

There *is* a GUI for adding/removing/editing/testing cron scheduled tasks
Code: [Select]
sudo apt-get install gnome-scheduleyou'll then find it at:
menu > System Tools > Scheduled tasks

Hint - running it from the menu will mean it's editing the users crontab
running it from the command line with:
Code: [Select]
gksudo gnome-schedulewill make it edit the root crontab.
« Last Edit: November 01, 2014, 06:57:34 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: Cronjob for SpiderOak
« Reply #2 on: November 01, 2014, 06:50:55 am »
Here are the requested outputs:
Spoiler (click here to view / hide)
[close]

As ROOT:
Spoiler (click here to view / hide)
[close]
And:
Code: [Select]
andy@AMILO-Li3710 /usr/bin $ ls -l /usr/bin/SpiderOak-Cronjob.sh
-rwxr-xr-x 1 755 root 77 nov  1 12:27 /usr/bin/SpiderOak-Cronjob.sh
andy@AMILO-Li3710 /usr/bin $
The command:
Code: [Select]
SpiderOakis the Shell Script that was contained in the original SpiderOak Deb:
Code: [Select]
#!/bin/sh

LD_LIBRARY_PATH="/opt/SpiderOak/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
QT_PLUGIN_PATH="/opt/SpiderOak/lib/plugins/" ; export QT_PLUGIN_PATH
SpiderOak_EXEC_SCRIPT=$(cd `dirname $0` ; pwd)/SpiderOak
export SpiderOak_EXEC_SCRIPT
exec "/opt/SpiderOak/lib/SpiderOak" "$@"
I tried using this Shell Script in the Cron Job and it did nothing.  That is why I tried running it with the simple Shell Script I wrote.  No it doesn't need to be launched as root.  This is totally new to me, so please excuse my naivety  ::).
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Cronjob for SpiderOak
« Reply #3 on: November 01, 2014, 07:09:35 am »
You have an entry in BOTH the user and root crontab

If I were you, I'd install gnome-schedule:
(see the edit in my last posting)

Then first use it from the menu to remove that user crontab entry

then start it from the command line with:
Code: [Select]
gksudo gnome-scheduleand remove the root crontab entry

Double check you have NO entries with both
Code: [Select]
crontab -land
Code: [Select]
sudo crontab -land if both are blank....

fire up gnome-schedule from the menu (so it's editing the user crontab), and use it to add your recurrent task .. pointing it DIRECTLY at the "Shell Script that was contained in the original SpiderOak Deb"

You can test it
a) with the "run selected task" button  <-- doesn't appear to work, even though the entry *does*  :-\
and/or
b) by setting it's time for just a couple of minutes in the future .. you can edit the time later.

Did that make sense ?

HINT -
If this is a graphical application you're attempting to start from cron,  you'll have to export the display (so it knows which X display to run it on) .. so the command to enter in crontab would be like:
Code: [Select]
export DISPLAY=:0 && /path/to/gui/appor in your case, possibly just
Code: [Select]
export DISPLAY=:0 && SpiderOak(DISPLAY=:0 being the default)

Hint 2 -
CRON jobs are logged to
/var/log/syslog
which may help in troubleshooting
« Last Edit: November 01, 2014, 08:40:58 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: Cronjob for SpiderOak
« Reply #4 on: November 01, 2014, 07:59:47 am »
Thanks for that, yes it made perfect sense.  The thing I don't understand is.  Why/what is the ls for in the default Command field?  I tried it with and without.  Nothing happens when I set it up and test it both as ROOT and User.  The command to execute is the Shell Script from the original Deb:
Code: [Select]
/usr/bin/SpiderOak.
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Cronjob for SpiderOak
« Reply #5 on: November 01, 2014, 08:12:16 am »
Is SpiderOak a GUI app ?

Can  you please re-read my previous posts .. I've made a few modifications to it including some hints .. and a comment that the "Run Selected Task" button doesn't seem to work.



BTW, I have ZERO idea why it enters "ls" as the default command .. probably as an example .. just replace it with your command ;)
« Last Edit: November 01, 2014, 08:14:03 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: Cronjob for SpiderOak
« Reply #6 on: November 01, 2014, 08:38:26 am »
Shazam!!!!
That did the Trick.  Yes, SpiderOak is a GUI package.  With the amount of RAM it uses, a better name would be GreedyGruntPig  :D.  Thanks for the help  ;)!!
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Cronjob for SpiderOak [SOLVED]
« Reply #7 on: November 01, 2014, 08:41:33 am »
As always, you're most welcome :)
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: Cronjob for SpiderOak [SOLVED]
« Reply #8 on: November 01, 2014, 02:20:09 pm »
Just an quick after thought.  How would I run a cron job to shutdown a GUI package like SpiderOak?  I'm just running through a scenario of me going away for a week or two.  Or If something happen that takes me away from a running machine for an extend period.  I very rarely turn my machine off, unless I'm testing something.  I don't want to come back to find upteen instances of SpiderOak etc up and running.  This old girl would hate that  ;D.
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Cronjob for SpiderOak [SOLVED]
« Reply #9 on: November 01, 2014, 02:46:46 pm »
I'm not sure there'd be any reliable way (short of rewriting it) to shut it down and be sure it'd finished doing the sync unless it emits a "finished" signal.

I suppose if you KNOW it only takes 10 mins .. you could do aanother cron job that runs an hour later that runs:
killall SpiderOak

But if anything goes wrong, that could end up killing it in the middle of a sync .. I doubt if that would corrupt anything at the SpiderOak servers, they must have a protocol to not become corrupt if the connection is lost.

Make sense ?
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: Cronjob for SpiderOak [SOLVED]
« Reply #10 on: November 01, 2014, 03:34:30 pm »
Yeah, perfect sense.  A daily backup never takes more than an hour, even with my slow broadband.  SpiderOak do have great protocols for interrupted syncs.  They just pick up where they left off seamlessly.  A killall SpiderOak cron job after 2 hours would give plenty of margin for error.  My only gripe with SpiderOak is it being a resource hungry beast.  It takes at least 10% of my 4GB of RAM.  That's fine if you've got 8GB or more.  Sourcing 4 more Gigs of DDR2 RAM is like trying to find "rocking horse poop" and really expensive if you do find it.  Thanks again  ;)!!
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Cronjob for SpiderOak [SOLVED]
« Reply #11 on: November 01, 2014, 04:00:00 pm »
Talking of the killall command reminded me of this .. click image to enlarge

« Last Edit: November 01, 2014, 04:03:52 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec