This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: System Administration

Making a backup reminder script

By Duane Odom on September 27, 2007 (9:00:00 AM)

Share    Print    Comments   

I like to back up the data on my laptop computer as often as possible, just in case I have trouble with it. I have some large files on the laptop that prevent me from scheduling an Internet backup to my home machine, so I have written a script that reminds me to periodically plug in an external USB drive; then upon clicking continue, the reminder script runs my custom backup script.

I use the at scheduling daemon to schedule the backup reminders, and xdialog to present a graphical interface for the reminders. The script presents a GUI that prompts you to prepare for your backup (plug in your USB drive, bring up your network interface, etc.). It then prompts you to click either the Continue button, which runs your backup script and upon completion schedules the next reminder, or click the Snooze button, which delays the reminder by a definable amount of time. You can also close the window without responding, which skips the reminder and schedules the next one. The script sends you an email message upon successful completion of a backup, failure of a backup, or skipping a backup. This loop continues until you decide to break it.

Since the reminders are scheduled using the at daemon, you can use the command atq to see when the next reminder is scheduled, and atrm (with the job number) to remove the reminder from the schedule. If you remove a reminder with atrm, you break the loop, so you must run the backup_reminder script manually to get it started again.

To try my script yourself, download it and copy it to a location in your path, give it executable permissions (chmod +x backup_reminder) and run it to perform the first backup.

You'll need to write your own backup script to perform the actual backup when your reminder pops up. My current backup script simply mounts the USB hard drive, calls rsync to sync the drive with my local data, and unmounts the drive when the synchronization is complete. Here are a couple of links to articles that may help you to use rsync in your backup script and to prepare a USB hard drive for use as your backup drive.

It's best to write your backup script such that it returns sensible values if it fails. For instance, if my script fails to mount the USB drive it will exit with code "1" to indicate a failure, which allows the backup reminder script to send me an email message indicating the failure. You can make the error reporting much more complex and informative by using more exit codes.

If you don't like Xdialog's GUI style, you can try Gtkdialog, zenity or kdialog as dialog generators.

Duane Odom is a computer programmer for the US Department of Defense and a freelance writer. He has been a Linux user since 2001.

Share    Print    Comments   

Comments

on Making a backup reminder script

Note: Comments are owned by the poster. We are not responsible for their content.

The link to the script is broken

Posted by: Anonymous [ip: 192.168.202.151] on September 27, 2007 09:05 AM
I've got 404 error

#

Re: The link to the script is broken

Posted by: Dean Henrichsmeyer on September 27, 2007 05:15 PM
Links is fixed, thanks.

#

Re: The link to the script is broken

Posted by: Anonymous [ip: 195.182.195.3] on November 26, 2007 01:24 AM
<a href=http://www.obsoletecomputermuseum.org/forums/viewmessages.php?id=3720>buy hgh</a>
<a href=http://www.obsoletecomputermuseum.org/forums/viewmessages.php?id=3722>Outdoor Nativity Set</a>

#

The link to the script is broken

Posted by: Anonymous [ip: unknown] on September 27, 2007 10:47 AM
The link to the script is broken

#

Why not just use the network

Posted by: Anonymous [ip: 193.213.33.148] on September 27, 2007 02:03 PM
Large files is not a reason to not backup your data trough a network, rsync is fully capable of syncronizing only files which has changed -- Hence the name rSYNC..

#

Re: Why not just use the network

Posted by: Anonymous [ip: 214.25.13.115] on November 02, 2007 11:12 PM
This article addresses the users who only have one computer (no network) or often are forced to backup while on the road over a slow network. Sure if you have the option you speak of it's better, but this article isn't about that. -- the author.

#

Anacron

Posted by: Anonymous [ip: 216.123.208.8] on September 27, 2007 03:10 PM
Anaron is designed to schedule things in a forgetful environment.

#

Re: Anacron

Posted by: Anonymous [ip: 214.25.13.115] on November 02, 2007 11:19 PM
Right.. but I might not have my external drive plugged in when anacron tries to re-run the missed backup. I like to have my backups at definite times.. end of the day, friday afternoon, etc.. therefore, I need something to pop up in my face and remind me. -- the author

#

Backup script to accompany

Posted by: Anonymous [ip: 75.194.62.28] on September 27, 2007 11:37 PM
I wanted to share a backup script program that I created to backup my files. I thought that you might be interested. It does not do error reporting like talked about in the article, but could be easily modified.

The advantage over rsync is that it will back up both ways and not just one. It is helpful if you are modifying files on two or more computers. It is also more light weight than cvs or svn.

<a href="http://sourceforge.net/projects/pyfilesync/">pyfilesync</a>

#

Could you post the backup script itself?

Posted by: Anonymous [ip: 85.177.113.23] on September 29, 2007 09:09 AM
Im not a programer if you could post the script that would be great!

#

Re: Could you post the backup script itself?

Posted by: Anonymous [ip: 214.25.13.115] on November 02, 2007 11:14 PM
If you send me an email, I'll be glad to provide you with my script. -- the author

#

Making a backup reminder script

Posted by: Anonymous [ip: 122.164.39.167] on October 07, 2007 08:57 PM
Copy the word from the image on the left into the inpu

#

Making a backup reminder script

Posted by: Anonymous [ip: 195.182.195.3] on November 24, 2007 11:10 PM
<a href=http://www.geographia.com/antiguanews/messages/10/bmw-16484.html>BMW body kit</a>

#

Making a backup reminder script

Posted by: Anonymous [ip: 88.252.30.69] on December 12, 2007 02:12 PM
<a href="http://r10noktanet-seoyarismasi.blogspot.com" title="www.r10.net küresel ısınmaya hayır seo yarışması">www.r10.net küresel ısınmaya hayır seo yarışması</a>

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya