Jump to content

how to automatically start pinging website when comp turns on?


modman860
 Share

5 posts in this topic

Recommended Posts

so if i leav the computer alone for like 5 minutes, or im not constantly downloading or pinging the internet goes down. the connectivity bars still stay full and it looks ok, but no webpages load and email doesnt work, etc. so i figured out the command in the terminal "ping -n www.google.com" this works, but i got to open the terminal at log in and enter in the command. i'd rather it did it automatically as an easy and quick patch to get the internet working good and without going down. any advice? thanks everyone!

Link to comment
Share on other sites

first thing, open TextEdit and paste

#!/bin/bash
ping -n -i 60 www.google.com

and save it as ping-google.sh, then open up terminal and type

$ sudo mv ~/Desktop/ping-google.sh /usr/local/bin/
$ sudo chmod +x /usr/local/bin/ping-google.sh

this makes it executable, then you need to create a plist to run it at startup, so type

$ sudo nano -w /System/Library/LaunchDaemons/com.internet.pinggoogle

now you can paste

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.internet.pinggoogle</string>
<key>ProgramArguments</key>
<array>
	<string>/usr/local/bin/ping-google.sh</string>
</array>
</dict>
</plist>

into the terminal window, then press ctrl + X and save the file and type

$ sudo launchctl start -w /System/Library/LaunchDaemons/com.internet.pinggoogle

then google will be pinged, once every 60 seconds and keep your internet alive

Link to comment
Share on other sites

Thank you so much for the response. I followed the instructions, but when I try to enter the last command, it says in the terminal: usage: launchctl start <job label> but wouldnt -w be the job label? i wonder why it wont work.... if someone can get me past this last step, itd be HIGHLY APPRECIATED and i'm sure others will benefit also. I tried restarting to see if it would automatically do the pinging and work iwthout the last command, but internet died... thanks again brainiac ghost, i know i'm close to fixing the problem!

Link to comment
Share on other sites

Ok i found the problem and fixed it. The file usr/local/bin/ping-google.sh wasn't opening when the computer turned on, permission denied. chmod'd 777 the file and it started working. so now anyone having this problem should be able to get it working. thanks again

Link to comment
Share on other sites

ok, found out what was wrong by looking at the system.log file. everytime the wifi goes down, right before it a proceess named ttys000 dies. when i turn off airport and turn it back on, ttys000 opens again with a different PID. what's weird is that it happens at random times, different time intervals between each time ttys dies. so if any of you kno what can fix this, i'd sure like to know. cuz i wont rest till i get it working

Link to comment
Share on other sites

 Share

×
×
  • Create New...