LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Simple Cron Job question (https://www.linuxquestions.org/questions/slackware-14/simple-cron-job-question-462970/)

FreezEy 07-11-2006 09:58 AM

Simple Cron Job question
 
I have a pretty decent size windows network... its got a bunch of servers with alot of information that normally i was running a simple batch file on a windows machine and backed everything up to some windows dir.... recently i started installing a bunch of linux machines( ubuntu slackware) and now i want to backup all the windows machines to this slackware server i made....

I have samba running everything is cool all the computers talk to eachother they seem to like eachother so i have no problem with the networking...

30 0 * * * thats the time interval for cronjob i am looking to use...

now what i want to do is backup everything i was backing up with the windows machine to the linux machine... just new to cron so i have no idea what kind of script to write for this...

example is: (for one of the server names)
(blue is the dir we are gonna backup to linux server)
\\server2\blue (where does this go how do i direct it just not sure)

You can post here or i am on AIM also Terrorizr2 ... if u think talking would help me out a bit more... thanks

jlinkels 07-11-2006 11:01 AM

I'll give you a pointer, not a complete HOWTO.

Usually it is recommended to write a bash script to do whatever you want to do, and call the bash script from cron. In my signature there is the URL of the Bash Scripting manual, in there you'll also find some tips for converting DOS scripts to Bash scripts. If you do only file copying it is very easy.

Then, I assume you have some Samba drives mounted in your Linux machine. You either want to backup from a Windows machine to a Linux machine, or from a Windows machine to another Windows machine.

If you have mounted your Samba drive on the Linux machine, you mostly find it back in /mnt, so:
/mnt/server2
Once the drive is mounted, you'll find the subdirectories there.

A copy action is something like:
cp /mnt/server2/blue/* /mnt/server1/blue_backup/.
from one Windows machine to another, or
cp /mnt/server2/blue/* /home/backup/blue_backup/.
to this Linux machine.

However, for backups etc, it is much better to use rsync. You can use rsync locally, that is from one drive in the file system, say /mnt/server2/blue, to another mounted drive, say /mnt/server1/blue_backup

rsync is very powerful, and has a zillion modes and options. Do check the man page and run a few tests before you bring it in the production environment.

jlinkels

FreezEy 07-11-2006 11:49 AM

backing it up this way does it overwrite the previous backup? or continue to make another folder for each time it backs it up>?

jlinkels 07-11-2006 01:30 PM

man cp
man rsync


All times are GMT -5. The time now is 10:53 PM.