Jump to content
5 posts in this topic

Recommended Posts

I'm running Kalyway 10.5.2 updated to 10.5.4 on a Gigabyte P35-DS3R with onboard Realtek 8169 LAN.

 

Everything works fine until the machine goes to sleep. As soon as it wakes up the IP address (assigned by DHCP using MAC filtering) is lost. In order to restore the connection I have to set the NIC to configure manually, enter an IP (doesn't matter what it is), hit apply, then change it back to DHCP before the IP is restored.

 

Is there a fix for this, or even a simple script which can be set to run automatically on wake?

Link to comment
https://www.insanelymac.com/forum/topic/115756-no-network-after-waking-up/
Share on other sites

I've written a small script and made it executable.

 

#!/bin/bash
 echo "password" | sudo -S ipconfig set en0 BOOTP
 sudo ipconfig set en0 DHCP

This corrects the issue by changing the NIC to use BOOTP then back to DHCP. This results in an instant connection.

 

My next task is to get this to run on wake, so I installed SleepWatcher. However, the daemon does not load on boot up, and attempting to run it manually results in:

 

/Library/StartupItems/SleepWatcher/SleepWatcher ; exit;

/Library/StartupItems/SleepWatcher/SleepWatcher: line 47: $1: unbound variable

logout

 

The file /Library/StartupItems/SleepWatcher/SleepWatcher reads:

#!/bin/sh
#
#	sleep watcher start script
#
#	17.11.2002 bb	created
#	24.12.2002 bb	moved sleepwatcher to /usr/local/sbin
#	01.01.2003 bb	added support for Mac OS X 10.1 and earlier
#	07.05.2003 bb	added "return 0" to the functions (otherwise,
#			SystemStarter syslogs a failure of the startup item)
#	05.05.2005 bb	call sleepwatcher 2.0 with options -d -V
#

# The Run/Restart/Start/StopService routines appeared in /etc/rc.common with
# Mac OS X 10.2. For earlier systems, we define our own RunService routine.
RunService ()
{
 ConsoleMessage "Starting Sleep Watcher"
 /usr/local/sbin/sleepwatcher -d -V -s /etc/rc.sleep -w /etc/rc.wakeup
 /etc/rc.wakeup
 return 0
}

. /etc/rc.common

StartService ()
{
 ConsoleMessage "Starting Sleep Watcher"
 /usr/local/sbin/sleepwatcher -d -V -s /etc/rc.sleep -w /etc/rc.wakeup
 /etc/rc.wakeup
 return 0
}

StopService ()
{
 ConsoleMessage "Stopping Sleep Watcher"
 killall sleepwatcher
 /etc/rc.sleep
 return 0
}

RestartService ()
{
 StopService
 StartService
}

RunService "$1"

With RunService "$1" being line 47. I am unsure as to what to do next. Any advice?

the script is supposed to be run by another one that passes it a variable. when you start it manually, it does not know what the value of "$1" is.

 

tiger had /etc/rc.local for starting scripts on bootup

 

leopard is supposed to use launchd and launchctl -- look at developer.apple.com for launchd.

 

/etc/rc.local can still be used for compatibility reasons.

 

 

or look here for an quicky example, not sure if its the 'proper' way:

http://codesnippets.joyent.com/posts/show/27

×
×
  • Create New...