Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 05-05-2008, 06:12 AM   #1
Simono
Guest
 
Posts: n/a
Help on how to get Mac to check IP then back up to Home Directory

Hello,

I'm trying to figure out how to create a script that would check I'm on my Work network then RSYNC the contents of my Documents folder to my Windows Home Directory share (I really don't want the Mac trying to connect to my Windows share on my home network). Also, Mac's aren't part of Active Directory in my work place and the Home Drives aren't delivered by Policy, I'd also have to mount my home drive prior to the RSYNC.

I have some bits and pieces of the puzzle but not enough scripting/Unix knowledge to build a functioning script out of it. For example :

To check the current IP I have found this prints my current LAN IP :
ifconfig en0 | awk '/inet / {print $2}'
But I would need the script to take the output and check the IP matches the first 2 octets of my work's class B network and if not send a failure message.

I know how to mount my home Drive :
mount_smbfs -W domain //user@server/share ~/mountpoint

I think this is how a basic RSYNC would work minus the exclusion of non work file types which I'll add later :
rsync -avz ~/Documents/ ~MountPoint/

It's a bit of a tall order but I'm mainly insterested in the first part of taking the IP output and creating an If/Then statement that'd confirm if on the right network.

Many thanks to anyone who replies, I'd really appreciate any, and that's ANY, input on this.


Best regards,

Simon
  Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 11:26 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.