Go Back   SharingDVB All Tutorials sharing > Emulator Tutorials > CardSharing Tutorials

Reply
 
Thread Tools Display Modes
Old 12-20-2014, 12:07 AM   #1
admin
Administrator
 
admin's Avatar
 
Join Date: Dec 2014
Posts: 219
Tuto Automated Backup Script for Oscam/CCcam configs



Automated Backup Script for Oscam/CCcam configs
Step 1: prepare for the script
Create a folder in /var called "oscam-configs-backup"
Code:
cd /var/
mkdir oscam-configs-backup
Step 2: Move Script to Server & Chmod it
FTP the script to /var/script
Chmod the script
Code:
chmod 755 /var/script/oscam-backup.sh
Step 3: Edit the script to suit your needs & Backup tye correct folders
HTML Code:
#!/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="/var/script /usr/local/etc /etc/crontab /etc/rc.local"

# 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
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
Code:
59 23   * * *   root    /var/script/oscam-backup.sh
Thats it, If you want to test the script, just run it with this command:
Code:
/var/script/oscam-backup.sh
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..
admin is offline   Reply With Quote
Reply

« Previous Thread | Next Thread »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:15 PM.
SharingDVB@
A vBSkinworks Design