A Python rdiff-backup Script

This little script is intended to be run by cron and will backup a local directory to a remote computer using SSH. It also automatically removes all increments older than a week. I use fcron so I can schedule the backup to be run daily rather than at a specific time which would be difficult with a laptop.

backup.py
#!/usr/bin/env python

import commands
import subprocess
import time
import signal
import os
import sys

backup_command = '/usr/bin/rdiff-backup --exclude /home/roddefig/server /home/roddefig debianmedia.home::/home/roddefig/backup/roddefig'
clean_command = '/usr/bin/rdiff-backup --force --remove-older-than 2W debianmedia.home::/home/roddefig/backup/roddefig'

#### Starting the backup ####

# Clean up old increments.
rdiff_backup = subprocess.Popen(clean_command, shell=True)
rdiff_backup.wait()

# Run the actual backup.
rdiff_backup = subprocess.Popen(backup_command, shell=True)
rdiff_backup.wait()     # Wait for the backup to finish.

sys.exit(os.EX_OK)