crontab backups?

10 views
Skip to first unread message

Stumpy

unread,
Dec 17, 2020, 8:29:32 AM12/17/20
to Qubes users
I havent played with crontab in forever, and I cant code at all, but I
really wanted to try to automate my backups a wee bit.

I made a basic script (qubackup) in the ~/ dom0 directory:
/home/bob/qvm-backup --yes --verbose --compress --passphrase-file
~/PASSPHRASE_FILE.txt /run/media/bob/drobo/backups/ anon-whonix
centos-7-minimal email chat work personal

and set crontab to run it every:
0 1 * * * /home/bob/qbackup

but it did not seem to work. I am able to run the script and the backup
will run but when i try to do it via cron then nada?

The crond seems to be running and crontab -l shows the schedule I pasted
above, Is there a reason this shouldn't work?

haaber

unread,
Dec 17, 2020, 8:48:01 AM12/17/20
to qubes...@googlegroups.com
I am no cron-expert, but in my exoerience cron and scripts often mess.
One reason seems " pipes " in scripts that usually fail when cron'ed.
Have a look at these "|" in the script and re-code them pipe-free -- to
my opinion that would be a good starting point. cheers

Stumpy

unread,
Dec 17, 2020, 9:11:31 AM12/17/20
to haaber, qubes...@googlegroups.com
Thanks!
I didnt realize that cron and scripts didnt mix, I just put one long
line into cron and it has started up!
Much appreciated!

Ulrich Windl

unread,
Dec 20, 2020, 6:56:43 PM12/20/20
to qubes...@googlegroups.com
On 12/17/20 2:32 PM, Stumpy wrote:
> I havent played with crontab in forever, and I cant code at all, but I
> really wanted to try to automate my backups a wee bit.
>
> I made a basic script (qubackup) in the ~/ dom0 directory:
> /home/bob/qvm-backup --yes --verbose --compress --passphrase-file
> ~/PASSPHRASE_FILE.txt /run/media/bob/drobo/backups/ anon-whonix
> centos-7-minimal email chat work personal
>
> and set crontab to run it every:
> 0 1 * * * /home/bob/qbackup
>
> but it did not seem to work. I am able to run the script and the backup
> will run but when i try to do it via cron then nada?

Checked the syslog? Did you use "crontab -e" to setup the crontab?

Ulrich Windl

unread,
Dec 20, 2020, 6:58:19 PM12/20/20
to qubes...@googlegroups.com
??? Your script was executable using "she-bang" (#!/bin/my_shell)?

>

Stumpy

unread,
Dec 21, 2020, 8:53:49 AM12/21/20
to Ulrich Windl, qubes...@googlegroups.com
Thank you for the response. It actually ended up that cron did not like
executing a script, I just put the exact same line from the script
directly into cron.

Now I just need to understand how to setup things to delete backups
older than X

Cheers

haaber

unread,
Dec 21, 2020, 10:39:30 AM12/21/20
to qubes...@googlegroups.com
>
> Thank you for the response. It actually ended up that cron did not like
> executing a script, I just put the exact same line from the script
> directly into cron.cron is not anti-script as such. I experienced
problems using pipes (I guess a pipe spawns off a new thread, that does
not necessarily run under the same user)
> Now I just need to understand how to setup things to delete backups
> older than X

using "find". to find *files* "f" (in contrast with "d") older than 30
days that are called backup*.luks, it would be

find /path -type f -iname backup\*.luks -mtime +30 -print

the word "-print" displays them.

Rem1: The first "*" must be backslashed in the find command, you don't
want bash to expand it!

Rem2: careful with auto-delete (don't complain :)
you replace -print by -delete



awokd

unread,
Dec 21, 2020, 4:54:04 PM12/21/20
to qubes...@googlegroups.com
Stumpy:

> Thank you for the response. It actually ended up that cron did not like
> executing a script, I just put the exact same line from the script
> directly into cron.

You can also put (executable) scripts directly in /etc/cron.daily or
.weekly and they should run without having to mess with crontab.

--
- don't top post
Mailing list etiquette:
- trim quoted reply to only relevant portions
- when possible, copy and paste text instead of screenshots
Reply all
Reply to author
Forward
0 new messages