Doh!  Didn't work on macOS because I forgot the -u username:password 
argument.  Safari used the login keychain so didn't need it.  Much better 
solution for a shell script.

On Wednesday, October 7, 2020 at 4:45:18 AM UTC-7 mh081...@gmail.com wrote:

> Yes, works with the script from my above reply with curl.... on raspberry 
> pi4 debian 10 
>
>
>
>
>
>
> jerry...@gmail.com schrieb am Dienstag, 6. Oktober 2020 um 21:01:31 UTC+2:
>
>> I'm curious if the curl command works to restart WiFiLogger2.  I first 
>> tried using the lynx command line browser and it did not resolve the page 
>> correctly and didn't restart.  I assumed that was because the restart page 
>> contains some javascript and lynx doesn't support javascript.  I then 
>> switched to Safari, which has the downside of needing a GUI.  
>>
>> So does curl work in the terminal script?  That's a better solution if it 
>> works.
>>
>> On Tuesday, October 6, 2020 at 6:37:57 AM UTC-7 gary....@gmail.com wrote:
>>
>>> Thanks for the Linux version of the script.
>>>
>>> On Tuesday, October 6, 2020 at 4:33:35 AM UTC-4 mh081...@gmail.com 
>>> wrote:
>>>
>>>> Thanks for the script. I changed it to be runnable from raspberry pi 
>>>> (Debian 10.4)
>>>>
>>>> #!/bin/sh
>>>> # Shell script to restart the weatherLogger wifi device in the Davis 
>>>> Vantage Pro 2 in the Harbormaster Building
>>>> # The weather logger tends to disconnect from network every 4 days 
>>>> causing weewx to crash in a waiting state
>>>> # Currently set to run by rycweather as a cron job once a day at 8:07 
>>>> am.
>>>> # check to see if weatherLogger is connected on Harbormaster vlan
>>>> /bin/ping -c 1 WiFiLogger.fritz.box
>>>> if [ "$?" = "0" ]; then
>>>>     weatherLoggerStatus="weatherLogger is online"
>>>> #   Using curl
>>>>     curl --connect-timeout 5 --fail 
>>>> http://WiFiLogger.fritz.box/admin/restart
>>>> #   wait to launch and load javascript function of URL
>>>>     sleep 30
>>>> else
>>>>     weatherLoggerStatus="weatherLogger is OFFLINE"
>>>> fi
>>>> # Check weatherLogger is connected again
>>>> /bin/ping -c 1 WiFiLogger.fritz.box
>>>> if [ "$?" = "0" ]; then
>>>>     newWeatherLoggerStatus="weatherlogger is back online"
>>>> else
>>>>     newWeatherLoggerStatus="weatherLogger is OFFLINE after restart"
>>>> fi
>>>> echo "$weatherLoggerStatus and after restart $newWeatherLoggerStatus" | 
>>>> sendemail -f mailadr...@mail.com -t mailad...@mail.com -u "WifiLogger 
>>>> Restart" -s mailserver.mail.com -xu "username" -xp "password" -o 
>>>> tls=yes -o message-content-type=auto
>>>> exit
>>>>
>>>>
>>>> jerry...@gmail.com schrieb am Dienstag, 6. Oktober 2020 um 09:36:22 
>>>> UTC+2:
>>>>
>>>>> WifiLogger2 doesn't have an ssh port open, but it does respond on port 
>>>>> 80 to a restart command from http.  Under macOS I use the shell script 
>>>>> command to open the Safair browser to the restart javascript command.
>>>>> #!/bin/sh
>>>>> # Shell script to restart the weatherLogger wifi device in the Davis 
>>>>> Vantage Pro 2 in the Harbormaster Building
>>>>> # The weather logger tends to disconnect from network every 4 days 
>>>>> causing weewx to crash in a waiting state
>>>>> # Currently set to run by rycweather as a cron job once a day at 8:07 
>>>>> am.
>>>>> # check to see if weatherLogger is connected on Harbormaster vlan
>>>>> /sbin/ping -c 1 192.168.145.106
>>>>> if [[ "$?" == "0" ]]; then
>>>>>     weatherLoggerStatus="weatherLogger is online"
>>>>> #   Using Safari browser
>>>>>     open -a Safari http://192.168.145.106/admin/restart
>>>>> #   wait for Safari to launch and load javascript function of URL
>>>>>     sleep 60
>>>>> #   close Safari
>>>>>     killall Safari
>>>>> else
>>>>>     weatherLoggerStatus="weatherLogger is OFFLINE"
>>>>> fi
>>>>> # Check weatherLogger is connected again
>>>>> /sbin/ping -c 1 192.168.145.106
>>>>> if [[ "$?" == "0" ]]; then
>>>>>     newWeatherLoggerStatus="weatherlogger is back online"
>>>>> else
>>>>>     newWeatherLoggerStatus="weatherLogger is OFFLINE after restart"
>>>>> fi
>>>>> echo "$weatherLoggerStatus and after restart $newWeatherLoggerStatus" 
>>>>> | mail -s "weatherLogger restart" xxx
>>>>> exit
>>>>>
>>>>>
>>>>> On Tuesday, October 6, 2020 at 12:23:03 AM UTC-7 mh081...@gmail.com 
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> can you provide me this shell script to restart  WifiLogger2  by 
>>>>>> cron? How did you connect to WifiLogger2 remotely? I have the same 
>>>>>> problem 
>>>>>> that WifiLogger2 disconnects from wlan after several days.
>>>>>>
>>>>>> jerry...@gmail.com schrieb am Dienstag, 6. Oktober 2020 um 09:15:11 
>>>>>> UTC+2:
>>>>>>
>>>>>>> I recently switched from a 3 hop retransmit across 1000 ft by 
>>>>>>> multiple Davis Vantage Pro2 links to WiFiLogger2 across an AirMax 
>>>>>>> backhaul 
>>>>>>> and the weewx server has been running well for several months.  I had 
>>>>>>> one 
>>>>>>> problem with the WiFiLogger2.  It seemed to disconnect from its vLAN 
>>>>>>> network every 4 days or so, which caused weewx to going into a waiting 
>>>>>>> mode 
>>>>>>> and not reconnect.  WiFiLogger2 eventually reconnects after about 2 
>>>>>>> hours, 
>>>>>>> but weewx needs to be restarted after that.  I fixed this problem by 
>>>>>>> running a short shell script as a cron job once a day to restart 
>>>>>>> WiFiLogger2.  WifiLogger2 has been stable if restarted once a day.  
>>>>>>>
>>>>>>> WifiLogger2 replaced a Davis Weather Envoy 6316 with a USB 
>>>>>>> interface.  I found the 6316 would freeze every 8 days (running 5 
>>>>>>> minute 
>>>>>>> update intervals). This was the case under WeatherLink for Windows, 
>>>>>>> WeatherLink for Mac, and Weewx.  Must be the USB driver.  Again, a cron 
>>>>>>> job 
>>>>>>> to restart weewx (or the other programs) every 7 days fixed the problem.
>>>>>>> Wojtek at WiFiLogger2 has been very responsive in helping to trouble 
>>>>>>> shoot the disconnect issues.  I am happy with WiFiLogger2.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Monday, October 5, 2020 at 12:58:45 PM UTC-7 gary....@gmail.com 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> I am thinking of upgrading my PWS to a Davis 6163.
>>>>>>>> To get the data into WeeWX, I am looking at two devices.
>>>>>>>> The Davis 6100 (WLL) or the WiFiLogger2
>>>>>>>>
>>>>>>>> I can find no real information about the WLL an local LAN.
>>>>>>>> I see a couple of user created drivers for the WLL and WeeWX, but 
>>>>>>>> they seem to have issues.
>>>>>>>>
>>>>>>>> The WiFiLogger2 has the ability to be used as a data logger via 
>>>>>>>> WiFi or it can provide a MQTT feed.
>>>>>>>>
>>>>>>>> Why the WLL or WiFiLogger? I don't wish to have my console located 
>>>>>>>> with my WeeWX server.
>>>>>>>>
>>>>>>>> Any feedback on either device?
>>>>>>>> I'd like to move forward, but if I can't get my data into WeeWX, 
>>>>>>>> then it's a non-starter.
>>>>>>>>
>>>>>>>>
>>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/79c0ef70-1ef0-45b7-a142-43acea7c378dn%40googlegroups.com.

Reply via email to