[arch-general] Scripting assistance
Hi .. Some i would like to do with the laptop when at home but not out and about When i am at home i would like the laptop to mount my NAS drive on boot always connect via ETH cable never wiFi but out if i connect via cable or wirless do not try to mount NAS drive , My thoughts Would it be possible to script it so that it checks for an specific MAC address before trying to mount the NAS as IP address would not work lots of 192.168.x.x networks out there Cheers Pete .
Something like if `ip link show eth0 | grep -q 'state UP'`; then you mount command hete fi in /etc/rc.local maybe
On 02/23/2012 03:25 AM, Jesse Juhani Jaara wrote:
Something like
if `ip link show eth0 | grep -q 'state UP'`; then you mount command hete fi
in /etc/rc.local maybe
You could also use 'arp' to check for your NAS mac address on the interface before issuing the mount command. gene/
On Thu, 23 Feb 2012 07:42:09 -0500 Genes MailLists <lists@sapience.com> wrote:
On 02/23/2012 03:25 AM, Jesse Juhani Jaara wrote:
Something like
if `ip link show eth0 | grep -q 'state UP'`; then you mount command hete fi
in /etc/rc.local maybe
You could also use 'arp' to check for your NAS mac address on the interface before issuing the mount command.
gene/
Hi all Thanks for the replies i will look into all of them in the next few days just had a right S***load of problem land so got to concentrate on them for a while thanks all Pete .
Hello Pete,
When i am at home i would like the laptop to mount my NAS drive on boot always connect via ETH cable never wiFi but out if i connect via cable or wirless do not try to mount NAS drive , My thoughts Would it be possible to script it so that it checks for an specific MAC address before trying to mount the NAS as IP address would not work lots of 192.168.x.x networks out there
A very simple solution would use netcfg profiles for your home network and connect to the NAS server with the POST_UP= param[1]. This would make things easier for you because you will not have to connect to the NAS on every boot (since you said its a laptop and i assume you use it on other places than your home) and only connect to the netowk you desire, either by wireless or wired. You can also add the PRE_DOWN to disconnect of your mount safely before disconnecting the network. If you desire you can set the network to start on boot (by simply adding the profile name to your rc.conf) but this will make your boot a little slower if you're not on your home (like connecting to your NAS does). [1] https://wiki.archlinux.org/index.php/Netcfg#Execute_commands_before.2Fafter_... -- Regards, Alfredo Palhares
On 02/23/12 at 10:04am, Alfredo Palhares wrote:
Hello Pete,
When i am at home i would like the laptop to mount my NAS drive on boot always connect via ETH cable never wiFi but out if i connect via cable or wirless do not try to mount NAS drive , My thoughts Would it be possible to script it so that it checks for an specific MAC address before trying to mount the NAS as IP address would not work lots of 192.168.x.x networks out there
A very simple solution would use netcfg profiles for your home network and connect to the NAS server with the POST_UP= param[1].
This would make things easier for you because you will not have to connect to the NAS on every boot (since you said its a laptop and i assume you use it on other places than your home) and only connect to the netowk you desire, either by wireless or wired. You can also add the PRE_DOWN to disconnect of your mount safely before disconnecting the network.
If you desire you can set the network to start on boot (by simply adding the profile name to your rc.conf) but this will make your boot a little slower if you're not on your home (like connecting to your NAS does).
[1] https://wiki.archlinux.org/index.php/Netcfg#Execute_commands_before.2Fafter_...
-- Regards, Alfredo Palhares
Along those same lines, if you use wicd, you can specificy different wired connection profiles and have your home profile execute your script -- would be a bit simpler as long as you're fine using wicd. Tim
participants (5)
-
Alfredo Palhares
-
Genes MailLists
-
Jesse Juhani Jaara
-
pete
-
Tim Stella