[Gllug] cron conundrum

Richard Jones rich at annexia.org
Wed Oct 6 21:34:15 UTC 2004


I'm trying to arrange a lo-tech database backup from a remote server.
First of all I want to dump the (PostgreSQL) database to a file on
/var/tmp, then I want to copy the file securely over to another
machine.

I've arranged two cronjobs for this, and neither of them do anything
at all.

The first one is on the database server itself, and it is:

--- /etc/cron.d/local.pg_dump ----------------------------------------
MAILTO=rich at annexia.org
0 2 * * * postgres rm -f /var/tmp/dump.sql.gz
5 2 * * * postgres pg_dumpall | gzip > /var/tmp/dump.sql.gz
----------------------------------------------------------------------

As far as I can see, this one doesn't even run.  It certainly doesn't
update the /var/tmp/dump.sql.gz file ever, and it's never sent me any
email either.  Do I need to do something to enable cron (it's a Debian
install, and /usr/sbin/cron does appear to be running ...)?

The second cronjob is a bit more tricky ...  On the server where I
want the dist file to end up, I initially put this into my personal
crontab:

$ crontab -l
MAILTO=rich at merjis.com
0 4 * * * scp -q DB.SERVER:/var/tmp/dump.sql.gz /home/rich/saved/

It's a bit stupid, because I realise now that scp running from cron
won't have access to my ssh-agent / private key, and so won't be able
to contact the database server.  However, this cronjob has never sent
me email either, which makes me wonder if it's even running.

What's the best way to allow the scp process to contact the server
securely anyway?

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
MONOLITH is an advanced framework for writing web applications in C, easier
than using Perl & Java, much faster and smaller, reusable widget-based arch,
database-backed, discussion, chat, calendaring:
http://www.annexia.org/freeware/monolith/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20041006/19aca93a/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list