LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   "I Need Simple Backup SH Script" (http://www.linuxquestions.org/questions/programming-9/i-need-simple-backup-sh-script-821203/)

aiushtha 07-21-2010 04:00 AM

"I Need Simple Backup SH Script"
 
Hi friends, search backup sh script thread in programming, but I cant find as I want.Please help me.

I want to simple script.

1-.tar selected folder (/ , /home etc.)
2-copy network drive (samba or nfs)
3-Send succes or fail mail.


Thanks in advance.

PS:for Redhat.

repo 07-21-2010 04:11 AM

Welcome to LQ
Did you tried google?
http://thewaystation.com/techref/unix/backups.shtml
http://www.google.be/search?hl=en&cl...=&oq=&gs_rfai=

aiushtha 07-21-2010 05:49 AM

Quote:

Originally Posted by repo (Post 4040431)

repo thanks for reply and links.

But I need example script for only in 1-2-3.Do you help me?

GrapefruiTgirl 07-21-2010 05:57 AM

Example scripts which do each of the 3 items you indicate, should be plentiful around the internet, and surely there are some examples right here on LQ, just a SEARCH away.. If you find some and edit them to suit your exact situation, or write your own, and it does not work as expected, please show us the scripts and paste verbatim any errors produced and/or describe the problem in detail, and we will try to help you fix the problems. Probably not many people are willing to write you your scripts, or do your searching for you.

Cheers!

choogendyk 07-21-2010 08:08 AM

At its simplest, a script is just a sequence of shell commands entered in a file. Give the file execute permissions and take off.

So, get the syntax for your tar commands, your copy commands, an email command, and put them in file. Test each by hand first. That makes your script.

If you put the script in cron, and it generates errors, you automatically get those by email. So, you might not even need the email part.

Ask questions on details if necessary.

All part of learning Linux.

aiushtha 07-21-2010 10:19 AM

Hi again,

I was modified this bash script.It's perfect works.But I don't know, how to send mail when finished?I'm using qmail.( mail to: ?, mail -s ? or ?)

repo 07-21-2010 10:45 AM

Quote:

Originally Posted by aiushtha (Post 4040867)
Hi again,

I was modified this bash script.It's perfect works.But I don't know, how to send mail when finished?I'm using qmail.( mail to: ?, mail -s ? or ?)

http://www.simplehelp.net/2008/12/01...-command-line/

aiushtha 07-22-2010 02:32 AM

hmm, mail -s command does not works to qmail..

I was created mail.sh and I wrote the following;
------------------------
telnet localhost 25
ehlo
mail from:a@host.com
rcpt to:b@client.com
data
backup success
.
quit
-------------------------

this is nice idea :)


but now problem is data integrity..! How do we do ?

anomie 07-25-2010 03:38 PM

Quote:

Originally Posted by aiushtha
hmm, mail -s command does not works to qmail..

You may need to create symlinks to help out mailx(1).

Read section 2.8.3 of the Life with qmail guide.

aiushtha 07-27-2010 06:01 AM

anomie, thanks for reply.

I was read life with qmail 1 weeks ago, but I can't find anything..

By the way, I solved the problem by installing Acronis.


All times are GMT -5. The time now is 06:50 PM.