Server Backup Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Server Backup Script
# 1  
Old 01-07-2018
Server Backup Script

im looking for a shell script for linux that backups up a specific folder/folders + the whole SQL db, archives into a password encrypted gpg file and uploads to google drive using API every 6 hours (via cron)

does a script like this exist?

---------- Post updated at 12:55 PM ---------- Previous update was at 08:25 AM ----------

the setup is like this
there are several servers running simple web servers (apache) with SQL databases.

I want to be able to specify in the script which folders to backup and then sql details

For example
/var
/opt/someprogram

SQL details
all databases
root user
root password

Then the script should (when run via cron every few hours) backup whole /var with all folders, subfolders, files under it with permissions preserved (in a .tar.gz preferably), along with the whole SQL database (all dbs using root/pass combo), and then encrypt them with a GPG encryption with a password I specify in the script.

When I download the backed up file (gpg), I just decrypt it with the pass, and it gives me the tar.gz with includes the selected directories and the sql file in the end.

/var
/opt/someprogram
databases.sql


The amount of data is only about 1-2 GB and the drives are SSD so I do not expect any issues in regards to performance.

I want this data backed up to 2 drives online for redundancy, like Yandex and google drive using the API login.

In the password I specify in the script (For gpg encryption), i would prefer if it was saved in a salted/hashed format in the script file and not visible in plaintext after I saved it.

i hope this is enough information
# 2  
Old 01-08-2018
Dear galapagos8000,

I have a few to questions pose in response first:-
  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using?
  • What 'SQL' database are you using? MySQL/MariaDB, Oracle or Informix perhaps?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.

You may need to create the backup then encrypt it as a second step depending on the database you have, but with such an incomplete request and nothing showing where you are up to, there is little I can suggest at this point.



Robin

Last edited by rbatte1; 01-08-2018 at 08:44 AM.. Reason: Inserting corect member name
# 3  
Old 01-08-2018
I am using this script
Shell backup script modification

But I need a new one.
# 4  
Old 01-08-2018
Would this be better continued on the other thread then? People have already been discussing your needs and I'm sure we could consider a variation.

Don't worry about not understanding it all, let's work out what you do know, then we can work through the code explaining it and you should end up being able to support it in future.



Kind regards,
Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Ubuntu

Backup Ubuntu server 12.05 LT

I wonder what free backup utilities fellow admins are using to clone or backup root disks of ubuntu servers. I try clonezilla, but errors pop up. Any ideas? ---------- Post updated at 02:51 PM ---------- Previous update was at 09:49 AM ---------- I have used the rsync command like: rsync... (0 Replies)
Discussion started by: fretagi
0 Replies

2. AIX

IBMR2 backup server

I am building a backup IBMR2 server with AIX 4.3 operating system. The application uses a TUXEDO front end. I am getting an authorization error when I try to bring the system up with tpchkauth error. I need to know how to find the value of this field so I can compare it to my production server. ... (3 Replies)
Discussion started by: lstribling
3 Replies

3. Shell Programming and Scripting

Help with Backup Shell Script for Network Device Configuration backup

HI all, im new to shell scripting. need your guidence for my script. i wrote one script and is attached here Im explaining the requirement of script. AIM: Shell script to run automatically as per scheduled and backup few network devices configurations. Script will contain a set of commands... (4 Replies)
Discussion started by: saichand1985
4 Replies

4. HP-UX

NTP Backup Server HP-Ux

Hi Can Anyone guide me in how to setup NTP backup server? say if server_A fails then client should automatically adjust time using server_B. Currently my /etc/ntp.conf file is configured as following server= server_A peer=server_B Will this configuration solve my purpose? Need Urgent... (12 Replies)
Discussion started by: sai_2507
12 Replies

5. Shell Programming and Scripting

rsync backup mode(--backup) Are there any options to remove backup folders on successful deployment?

Hi Everyone, we are running rsync with --backup mode, Are there any rsync options to remove backup folders on successful deployment? Thanks in adv. (0 Replies)
Discussion started by: MVEERA
0 Replies

6. Solaris

Server Backup

Hi, As per my understanding in sun ufsdump and snap are 2 methods of backup of file system. what is inode table backup? or can we take only inode table backup? Regards Manu (1 Reply)
Discussion started by: manoj.solaris
1 Replies

7. Linux

How to backup a Linux server?

Dear All Can you please let me know how to backup my Linux server for preserving data in case if hard disk crashes? Thank you (1 Reply)
Discussion started by: hadimotamedi
1 Replies

8. Red Hat

How to backup a RedHat server?

Dear All Can you please let me know how to backup my RedHat server for preserving data in case if hard disk crashes? Thank you Double post, continued here (0 Replies)
Discussion started by: hadimotamedi
0 Replies

9. Red Hat

OS backup of a Redhat 5 server.

Hi, I am looking for a way to take the full backup of a redhat linux 5 server. I am familiar with ignite ux for HP-UX and flarcreate in Solaris. Looking for something for redhat Tx (3 Replies)
Discussion started by: uxadmin007
3 Replies
Login or Register to Ask a Question