LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-08-2005, 05:56 PM   #1
High-Hopes
LQ Newbie
 
Registered: Dec 2004
Location: Naugatuck, CT
Distribution: Open SuSE 10
Posts: 9

Rep: Reputation: 0
Question mirror windows shared over Samba to linux


I'm trying to find a way to mirror a shared directory that resides on a windows 98 box to a SuSE 9.2 PRO linux box. I searched through google and this site and all similar topics call for using ssh or some similar method involving installing/running apps on the windows machine. I would like to avoid if at all possible installing anything on that machine as it is prone to crashing with excess software running (Can you picture that?) Security is not an issue; I am behind a firewall. I want this to be an automated process that does incremental updates (rsync?) every 4 hours or so. Also, while the Linux mach. is always on, the windows box isn't so maybe this would have to be taken into account when generating an automated script? I am new to Linux, so please be specific. I want the destination directory to always exactly match the source to include deleting files in the target that have been deleted from the source.
 
Old 02-09-2005, 08:58 AM   #2
High-Hopes
LQ Newbie
 
Registered: Dec 2004
Location: Naugatuck, CT
Distribution: Open SuSE 10
Posts: 9

Original Poster
Rep: Reputation: 0
Anyone?
 
Old 02-09-2005, 04:07 PM   #3
High-Hopes
LQ Newbie
 
Registered: Dec 2004
Location: Naugatuck, CT
Distribution: Open SuSE 10
Posts: 9

Original Poster
Rep: Reputation: 0
OK, I so far I've figured out how to use rsync to mirror the the win 98 folder. First, I mount the Windows share using
mount -t smbfs -o username=username,password=password //windowsbox/share /mnt/windows
then
rsync -urptq --delete-after /mnt/windows/ /home/backup
then I unmount the drive again with:
umount //windowsbox/share

Now, what I need to know is how to make script to run this as a cron job every four hours or so. I also need for this script to verify that the windows box is online before attempting the rsync. I know NOTHING about cron type stuff so if anyone could help me there, please be specific.
 
Old 02-09-2005, 06:53 PM   #4
High-Hopes
LQ Newbie
 
Registered: Dec 2004
Location: Naugatuck, CT
Distribution: Open SuSE 10
Posts: 9

Original Poster
Rep: Reputation: 0
I think I've got it.
I opened a text editor and inserted the following script:
#!/bin/bash
#
# Runs rsync to mirror //windowsbox/share directory to this computer
# First it mounts the directory, then checks to see if it can access a file
# If yes, then it runs rsync and unmounts the directory
#

# Mount the shared folder //windowsbox/share
cd /
mount -t smbfs -o username=username,password=password //windowsbox/share /mnt/windows
# Test to see if a directory in /share is accessible
if [ -d "/mnt/windows/directory" ]; then
# Mirror //windowsbox/share to /home/backup if yes
rsync -urptq --delete-after /mnt/windows/ /home/backup 2>&1 > /var/log/hourly_backup.log
else
echo "directory is NOT accessible"
fi
# Unmount the shared folder //windowsbox/share
umount //windowsbox/share
echo "Finished"

Next I saved the file as /usr/bin/backup.sh
Then I created another text file containing:

* 10,12,14 * * * root /usr/bin/backup.sh
and saved it as /etc/cron.d/backup
This should run the script daily at 10am, 12pm, and 2pm

Hopefully, this should work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing to a windows shared printer using Samba Maskkkk Slackware - Installation 4 09-02-2009 11:39 AM
Samba not accessing my Windows Shared folders Felpipe Linux - Networking 3 08-04-2005 08:34 AM
Windows sees Samba shared drive; Linux can't tnandy Linux - Networking 3 09-13-2004 01:00 PM
Windows printing to samba shared printer?l rohang Linux - Networking 4 09-01-2004 11:20 PM
Samba 3: Can't write to shared directories from Windows robintw Linux - Networking 10 07-31-2004 09:13 PM


All times are GMT -5. The time now is 09:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration