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
9 More Discussions You Might Find Interesting
1. Red Hat
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
2. Red Hat
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
3. Linux
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
4. Solaris
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
5. Shell Programming and Scripting
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. 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
7. Shell Programming and Scripting
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
8. AIX
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
9. Ubuntu
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
SCRIPT(1) BSD General Commands Manual SCRIPT(1)
NAME
script -- make typescript of terminal session
SYNOPSIS
script [-a] [-c COMMAND] [-e] [-f] [-q] [-t] [file]
DESCRIPTION
Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive
session as proof of an assignment, as the typescript file can be printed out later with lpr(1).
If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript.
Options:
-a Append the output to file or typescript, retaining the prior contents.
-c COMMAND
Run the COMMAND rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves
differently when its stdout is not a tty.
-e Return the exit code of the child process. Uses the same format as bash termination on signal termination exit code is 128+n.
-f Flush output after each write. This is nice for telecooperation: One person does `mkfifo foo; script -f foo' and another can super-
vise real-time what is being done using `cat foo'.
-q Be quiet.
-t Output timing data to standard error. This data contains two fields, separated by a space. The first field indicates how much time
elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used
to replay typescripts with realistic typing and output delays.
The script ends when the forked shell exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not
set) for the C-shell, csh(1)).
Certain interactive commands, such as vi(1), create garbage in the typescript file. Script works best with commands that do not manipulate
the screen, the results are meant to emulate a hardcopy terminal.
ENVIRONMENT
The following environment variable is utilized by script:
SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most
shells set this variable automatically).
SEE ALSO
csh(1) (for the history mechanism), scriptreplay(1).
HISTORY
The script command appeared in 3.0BSD.
BUGS
Script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.
AVAILABILITY
The script command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
Linux July 30, 2000 Linux