duplicity and crontab

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

duplicity and crontab

duplicity-talk mailing list
Hello to all, 

I have made a shell script to perform a backup with duplicity, the script works well if I run it from xterm. 
However, when I try to run the script with cron for automatising the backup something does not work 
with duplicity. I looked in the web but it is not clear what is the way out. 

Has anyone succeeded to do this? 

Thanks 

Giuliano


_

Giuliano Franchetti

Storage Rings/ Accelerator Operations

Office:         C26 1.019
phone:       +49 6159 71 1535
fax:             +49 6159 71 3099
[hidden email]
http://web-docs.gsi.de/~giuliano 

GSI Helmholtzzentrum für Schwerionenforschung GmbH
Planckstraße 1, 64291 Darmstadt, Germany, www.gsi.de

Commercial Register / Handelsregister: Amtsgericht Darmstadt, HRB 1528
Managing Directors / Geschäftsführung:
Professor Dr. Paolo Giubellino, Dr. Ulrich Breuer, Jörg Blaurock
Chairman of the Supervisory Board / Vorsitzender des GSI-Aufsichtsrats:
State Secretary / Staatssekretär Dr. Georg Schütte

Commercial Register / Handelsregister: Amtsgericht Darmstadt, HRB 1528
Managing Directors / Geschäftsführung:
Professor Dr. Paolo Giubellino, Ursula Weyrich, Jörg Blaurock
Chairman of the Supervisory Board / Vorsitzender des GSI-Aufsichtsrats:
Ministerialdirigent Dr. Volkmar Dietz





_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk
Reply | Threaded
Open this post in threaded view
|

Re: duplicity and crontab

duplicity-talk mailing list
On 11/6/2020 12:45, Giuliano Franchetti via Duplicity-talk wrote:
> Hello to all, 
>
> I have made a shell script to perform a backup with duplicity, the script works well if I run it from xterm. 
> However, when I try to run the script with cron for automatising the backup something does not work 
> with duplicity. I looked in the web but it is not clear what is the way out. 
>
> Has anyone succeeded to do this? 

indeed some did :) i can give you some hints.

there's probably an error in your /var/log/messages or syslog. check that.

did you provide a proper PATH variable in your crontab? most crons have only a limited path set initially.

ordinary cron daemons support MAILTO so any output is send via mail too the given address. you might want to set set for debugging or generally.

..ede/duply.net


_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk
Reply | Threaded
Open this post in threaded view
|

Re: duplicity and crontab

duplicity-talk mailing list
One other thing to check:  Cron jobs run as root by default.  You'll need to check that duplicity has access to ~root/.gnupg and that your keys are there.

...Ken


On Fri, Nov 6, 2020 at 6:19 AM edgar.soldin--- via Duplicity-talk <[hidden email]> wrote:
On 11/6/2020 12:45, Giuliano Franchetti via Duplicity-talk wrote:
> Hello to all, 
>
> I have made a shell script to perform a backup with duplicity, the script works well if I run it from xterm. 
> However, when I try to run the script with cron for automatising the backup something does not work 
> with duplicity. I looked in the web but it is not clear what is the way out. 
>
> Has anyone succeeded to do this? 

indeed some did :) i can give you some hints.

there's probably an error in your /var/log/messages or syslog. check that.

did you provide a proper PATH variable in your crontab? most crons have only a limited path set initially.

ordinary cron daemons support MAILTO so any output is send via mail too the given address. you might want to set set for debugging or generally.

..ede/duply.net


_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk

_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk
Reply | Threaded
Open this post in threaded view
|

Re: duplicity and crontab

duplicity-talk mailing list
unless they are user cronjobs of course ;) set up via 'crontab -e' in user context.

but Ken is right. often users edit crontabs under /etc and the wonder why duplicity using key enc does not work while it did in their user's shell. the above is a common pitfall.

.ede/duply.net

On 06.11.2020 16:33, Kenneth Loafman via Duplicity-talk wrote:

> One other thing to check:  Cron jobs run as root by default.  You'll need to check that duplicity has access to ~root/.gnupg and that your keys are there.
>
> ...Ken
>
>
> On Fri, Nov 6, 2020 at 6:19 AM edgar.soldin--- via Duplicity-talk <[hidden email] <mailto:[hidden email]>> wrote:
>
>     On 11/6/2020 12:45, Giuliano Franchetti via Duplicity-talk wrote:
>     > Hello to all, 
>     >
>     > I have made a shell script to perform a backup with duplicity, the script works well if I run it from xterm. 
>     > However, when I try to run the script with cron for automatising the backup something does not work 
>     > with duplicity. I looked in the web but it is not clear what is the way out. 
>     >
>     > Has anyone succeeded to do this? 
>
>     indeed some did :) i can give you some hints.
>
>     there's probably an error in your /var/log/messages or syslog. check that.
>
>     did you provide a proper PATH variable in your crontab? most crons have only a limited path set initially.
>
>     ordinary cron daemons support MAILTO so any output is send via mail too the given address. you might want to set set for debugging or generally.
>
>     ..ede/duply.net <http://duply.net>
>
>
>     _______________________________________________
>     Duplicity-talk mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.nongnu.org/mailman/listinfo/duplicity-talk <https://lists.nongnu.org/mailman/listinfo/duplicity-talk>
>
>
> _______________________________________________
> Duplicity-talk mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/duplicity-talk
>


_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk
Reply | Threaded
Open this post in threaded view
|

Re: duplicity and crontab

duplicity-talk mailing list
In reply to this post by duplicity-talk mailing list
Cron jobs run with a reduced environment in comparison to your standard bash shell. e.g. I think they actually run with sh rather than a full bash. But definitely with a minimal PATH environment. So you will probably want to include a PATH directive in your shell script. Simply copy the output of:

env | grep PATH

into your shell script. Put that line before you run any actual shell comands in your script.
It might also help if you include a bash header in your script, e.g.

#!/usr/bin/env bash

or something like that.
You could also include a "pipe to logfile" option in your crontab entry, e.g.:

00 02 * * * /command/to/run.sh > logfile.log






On 06.11.20 12:45, Giuliano Franchetti via Duplicity-talk wrote:
Hello to all, 

I have made a shell script to perform a backup with duplicity, the script works well if I run it from xterm. 
However, when I try to run the script with cron for automatising the backup something does not work 
with duplicity. I looked in the web but it is not clear what is the way out. 

Has anyone succeeded to do this? 

Thanks 

Giuliano


_

Giuliano Franchetti

Storage Rings/ Accelerator Operations

Office:         C26 1.019
phone:       +49 6159 71 1535
fax:             +49 6159 71 3099
[hidden email]
http://web-docs.gsi.de/~giuliano 

GSI Helmholtzzentrum für Schwerionenforschung GmbH
Planckstraße 1, 64291 Darmstadt, Germany, www.gsi.de

Commercial Register / Handelsregister: Amtsgericht Darmstadt, HRB 1528
Managing Directors / Geschäftsführung:
Professor Dr. Paolo Giubellino, Dr. Ulrich Breuer, Jörg Blaurock
Chairman of the Supervisory Board / Vorsitzender des GSI-Aufsichtsrats:
State Secretary / Staatssekretär Dr. Georg Schütte

Commercial Register / Handelsregister: Amtsgericht Darmstadt, HRB 1528
Managing Directors / Geschäftsführung:
Professor Dr. Paolo Giubellino, Ursula Weyrich, Jörg Blaurock
Chairman of the Supervisory Board / Vorsitzender des GSI-Aufsichtsrats:
Ministerialdirigent Dr. Volkmar Dietz





_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk



_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk