Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4 Server: Another way to mount shares at login' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4 Server: Another way to mount shares at login
Authored by: xSmurf on Jan 12, '06 10:09:10AM
I've made myself a little shell script to handle that. I then run it every 2 minutes using launchd. It only supports share from one server but it wouldn't be hard to modify that. I suggest you chmod 700 this script as it will hold your login/password in clear text.


#!/usr/bin/env php

<?PHP
$remote_addr	= '169.0.1.2';				// The server's remote address
$afp_share	= array('Mount1', 'Mount2', 'Mount3');	// List your shares
$afp_user	= 'USERNAME';				// Your afp users
$afp_password	= 'PASSWORD';				// Your afp password

if ($argv[1]) $remote_addr = $argv[1];

exec('ping -t 1 -c 1 '.$remote_addr, $exec_ping);

if (!strpos(implode('', $exec_ping), '100% packet loss')) {
	for ($i = 0;$i<count($afp_share);$i++) {
		if (!is_dir('/Volumes/'.$afp_share[$i])) {
			exec('mkdir /Volumes/'.$afp_share[$i]);
			exec('mount_afp afp://'.$afp_user.':'.$afp_password.'@'.$remote_addr.'/'.$afp_share[$i].' /Volumes/'.$afp_share[$i]);
			exec('umask 022 /Volumes/'.$afp_share[$i]);
			exec('disktool -r');
			echo date("Y-m-d G:i:s")." - CheckAFP: Mounting AFP Share {$afp_share[$i]} @ {$remote_addr}\n";
		} else {
			//echo "AFP Share: '{$afp_share[$i]} @ {$remote_addr}' already mounted\n";
		}
	}
}
exit(0);
?>

---
SnitchCTL : http://snitchctl.smurfturf.net/

PM G4 DP 800 / 1.25gb / 120Gb+80Gb / CD/DVD±RW/RAM/DL
- The only APP Smurf

[ Reply to This | # ]