Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I found this link:

http://bash.cyberciti.biz/backup/backup-directories-from-linux-to-windows-server/

And that looks like what I need...but I'm a complete noob to Linux and don't want to screw anything up.

I'm basically wanting to backup a Linux folder to a Windows folder on a remote Windows 2008 Server and schedule it. I need to make sure it captures open files if possible and I need it to create a log of what it backed up (and place that log in the remote Windows folder)

SERVER = Gentoo Linux 1.12.9

I'd like to know the following:

  1. How do I take this script and put it on the Linux server? Copy/paste it into what program? Vi?
  2. What do I call the script (filename.ext) in order for it to run? Do I need to place it in a certain directory on the linux server?
  3. Once I test the script and can confirm it works, how do I schedule it to run?
  4. What about the backup logging...?

Thank you!

share|improve this question
    
Do you have an existing backup solution in place (Backup Exec, etc.)? It would make more sense for you to either share out this Linux directory using SAMBA, NFS, SFTP, or install an agent that came with your backup solution then try to figure out how to do a "push" backup from Gentoo. –  gravyface Dec 13 '10 at 17:05
    
Before you do this, ask yourself if you have a way to restore the backups this mysterious script makes. –  Allen Dec 13 '10 at 18:49
    
I see where you're going with this, but the script looks like your standard Bash backup-to-gzip'ed/tarball script, so anything from Winrar to tar would work for "restoring" (extracting) the backup. What I don't like is how the NT username/password is a read on stdin in plain text! –  gravyface Dec 13 '10 at 19:11
    
gravyface, how could I share out the directory using SAMBA as a hidden share? –  TheCleaner Dec 14 '10 at 19:36

1 Answer 1

up vote 1 down vote accepted
  1. You could use vi if you're familiar with it. If nano is installed you may find it easier to use if you're not already a vi user.
  2. You can call it almost anything you want. It doesn't need an extension (although it could be anything - some people use .sh). A good place to put it would be /usr/local/bin. You will need to issue chmod u+x scriptname to make it executable by the owner of the script (presumably root - you may need to do sudo chown root:root scriptname). To make it executable by everyone you can do chmod a+x scriptname. You may need to prefix the chmod commands with sudo followed by a space.
  3. You can add an entry in the crontab for the user it's to run under or place a wrapper script (which includes a call to the backup script along with the desired arguments) in the /etc/cron.daily directory, for example. The choice of crontab or cron directory depends partly on how frequently you're running the job.
  4. Your wrapper script will be logged when it's run as a cron job. For more detailed logging, you can add the logger command in it or the main script.

There are a lot of details included in what I've outlined above. If you have specific questions about particular items they should be posted as separate questions (unless it's a simple followup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.