Automated Backup Script for Oscam/CCcam configs
Here is a handy script to backup all your CS Server configs every night..
oscam-backup.rar
Step 1: prepare for the script
Create a folder in /var called "oscam-configs-backup"
Step 2: Move Script to Server & Chmod it
FTP the script to /var/script
Chmod the script
Step 3: Edit the script to suit your needs & Backup tye correct folders
#!/bin/sh
####################################
# Backup Oscam Configs script.
# tahtfellow - Linuxsat-Support
####################################
# What to backup. (Add or edit the folders/files below to cover your needs)
backup_files="[COLOR='#FF0000']/var/script /usr/local/etc /etc/crontab /etc/rc.local[/COLOR]"
# Where to backup to.
dest="/var/oscam-configs-backup"
# Create archive filename.
datetime=$(date +"%Y-%m-%d-%H.%M.%S")
hostname=$(hostname -s)
archive_file="$datetime-oscam_configs_backup-$hostname.tgz"
# Print start status message.
echo "Backing up $backup_files to $dest/$archive_file"
date
echo
# Backup the files using tar.
tar czf $dest/$archive_file $backup_files
# Print end status message.
echo
echo "Backup finished"
date
# Long listing of files in $dest to check file sizes.
ls -lh $dest
Display More
The folders & Files in Red are the files I backup for my server, you might want to add Files & Folders for your setup.
This is the only line in the script than might need editing
For example, If you wanted to add CCcam files to the backup, just add "/var/etc/*CCcam*" to the script. So the line would look like this:
backup_files="/var/script /usr/local/etc /var/etc/*CCcam* /etc/crontab /etc/rc.local"
Step 4: Auto run the Script from crontab
Just add this line to /etc/crontab
Thats it, If you want to test the script, just run it with this command:
Then test the Archive it creates at /var/oscam-configs-backup
Every few weeks I move all the backups to my local PC to keep safe.
These backups have come to my rescue many times..