Re: Cron job for backup

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Jones
Date:  
To: Main PLUG discussion list
Subject: Re: Cron job for backup
Couple of thoughts:

cron jobs usually have a slightly different shell environment ($PATH,
etc)...I suspect what was going wrong was it could not find the full
path to dpkg or something like that.

I would suggest additionally using the -p flag for your cp command, so
that you preserve the file attributes (or use rsync..or even rsnapshot).

-Charles

gm5729 wrote:
> Okay I got this cron job accomplished. The command I was going to use
> would not run properly in crontab most likely because of some unknown
> syntax problem. However, I did get a cron job going by making a simple
> script to run from cron instead.
>
> 0 OrangeRoot1000@VampirePenguin: ~
> Fri Dec 14, 00:37 $ cat /usr/local/bin/LappieBackupScript
> #!/bin/bash
>
> echo "Backup started on: $(date -u +%Y%m%d-%H:%M)"
> dpkg --get-selections >
> /home/OrangeRoot1000/Documents/ConfigurationFiles/CurrentPackagesInstalled.log
> crontab -l > /home/OrangeRoot1000/Documents/ConfigurationFiles/crontab.conf.OrangeRoot1000
> cp -Ru /usr/local/bin /home/OrangeRoot1000/Documents/ConfigurationFiles
> cp -Ru /etc/apt /home/OrangeRoot1000/Documents/ConfigurationFiles
> cp -u /etc/network/interfaces
> /home/OrangeRoot1000/Documents/ConfigurationFiles/interfaces
> cp -u /etc/X11/xorg.conf
> /home/OrangeRoot1000/Documents/ConfigurationsFiles/xorg.conf
> cp -a /home/OrangeRoot1000
> /media/disk/OrangeRoot1000Backups/Lappie$(date -u +%Y%m%d-%H:%M)
>
>
>
> echo "Backup completed on: $(date -u +%Y%m%d-%H:%M)"
>
> df -h
>
> ************************
>
> 0 OrangeRoot1000@VampirePenguin: ~
> Fri Dec 14, 00:38 $ crontab -l
> # m h dom mon dow command
> 50 12 * * 2,5 /usr/local/bin/LappieBackupScript >> /tmp/LappieBackupLog
> # This file was written by KCron. Copyright (c) 1999, Gary Meyer
> # Although KCron supports most crontab formats, use care when editing.
> # Note: Lines beginning with "#\" indicates a disabled task.
> ******************************
>
> TaDa!!!!!!! The only thing I have to remember is to turn my usb hdd on
> now.... LOL
>
> Vampy
>
>
>
>
>
> On Dec 11, 2007 12:42 PM, gm5729 <> wrote:
>
>> Thanks guys. I thought it had to do something with the $() and date
>> formats but wasn't quite sure. I used a program called keep which is
>> really nice and easy and all gui for KDE but it hosed my whole usb
>> partition and set up its own file structure and I don't know if it was
>> full backups or just incrementals..
>>
>> VP
>>
>>
>>
>>
>> On Dec 11, 2007 5:33 AM, gm5729 <> wrote:
>>
>>> I am looking at trying to set up a cron job to do automatic backups of
>>>
>>> VampirePenguin
>>>
>>>
>


---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss