Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: confuse wifi card (reboot software needed)

  1. #11
    FLAC
    Join Date
    Sep 2004
    Posts
    1,577
    Try:
    shutdown -r -t 0
    from a command window.
    Progress: 80% - Permanent install left.
    Motion LS800 Tablet PC and dock.
    Vista, Bu-535 GPS, RoadRunner, MPT2006.

  2. #12
    lez
    lez is offline
    FLAC lez's Avatar
    Join Date
    Jan 2004
    Location
    UK
    Posts
    1,334
    Nice but no cigar.

    A cron jobwont help because I dont know if it has crashed every hour, and a shutdown program does just that, shuts down or reboots the machine.

    I want a program that reboots the machine if after 5 minutes the internet is down.

    Such things where very common some years ago, but I never had to use one back then and cant remember the names of any that where popular.

  3. #13
    FLAC
    Join Date
    Sep 2004
    Posts
    1,577
    Save this is as rebootifnecessary.cmd
    @ECHO OFF
    ping www.google.com
    if "%ERRORLEVEL%"=="1" (
    shutdown -r -t 0
    )
    I'm not sure if the error level is 1 for a failed ping due to lack of connection. It definitely is if you attempt to ping a host that doesn't exist.

    Firewalls and the like may interfere with your ability to ping anyone. Make sure www.google.com is pingable - I can't check from work. yahoo.com definitely used to be.
    Progress: 80% - Permanent install left.
    Motion LS800 Tablet PC and dock.
    Vista, Bu-535 GPS, RoadRunner, MPT2006.

  4. #14
    FLAC
    Join Date
    Sep 2004
    Posts
    1,577
    Or, you could make it more complicated. Something like:
    @ECHO OFF
    set REBOOTREQUESTED=0
    :Loop
    ping www.google.com
    if "%ERRORLEVEL%"=="0" (
    if "%REBOOTREQUESTED%"=="1" (
    ECHO Cancelling pending shutdown request. Internet came back.
    set REBOOTREQUESTED=0
    shutdown -c
    )
    ) else (
    ECHO No internet connection found. Setting reboot in 5 minutes.
    set REBOOTREQUESTED=1
    shutdown -r -t 300
    )
    goto :Loop
    Progress: 80% - Permanent install left.
    Motion LS800 Tablet PC and dock.
    Vista, Bu-535 GPS, RoadRunner, MPT2006.

  5. #15
    Variable Bitrate numbers's Avatar
    Join Date
    May 2005
    Posts
    370
    Good thinking. I hadn't thought of doing it with a batch file. Here's the same one cleaned up, with a typo or two fixed, and an extra if clause. I went ahead and tested it. Works great. Good work!

    Code:
    @ECHO OFF
    set REBOOTREQUESTED=0
    :Loop
    ping www.google.com
    if %ERRORLEVEL% == 0 (
    if %REBOOTREQUESTED% == 1 (
    ECHO Cancelling pending shutdown request. Internet came back.
    set REBOOTREQUESTED=0
    shutdown -a
    )
    ) else (
    if %REBOOTREQUESTED% == 0 (
    ECHO No internet connection found. Setting reboot in 5 minutes.
    set REBOOTREQUESTED=1
    shutdown -r -t 300 -c "This computer is rebooting in order to regain network connectivity"
    )
    )
    goto :Loop

  6. #16
    lez
    lez is offline
    FLAC lez's Avatar
    Join Date
    Jan 2004
    Location
    UK
    Posts
    1,334
    Ha now that makes sense, and windows xp understands that?

    I think the formatting of the () is being upset

  7. #17
    Variable Bitrate numbers's Avatar
    Join Date
    May 2005
    Posts
    370
    Unfortunately when structuring things in batch files with ) and (, you can't make it look all pretty due to the fact that newline characters are used as the end of each command.

    And for anyone who saw what I posted and scratched their head before I got a chance to edit it - I had forgotten to remove the "echo" before each "shutdown" command before posting the code. When I tested it, I didn't want the shutdown commands actually running, so I echo'd them to the console instead.

  8. #18
    FLAC
    Join Date
    Sep 2004
    Posts
    1,577
    Yep, I just typed this in to the forum and did no testing . Glad it's working for you.
    Progress: 80% - Permanent install left.
    Motion LS800 Tablet PC and dock.
    Vista, Bu-535 GPS, RoadRunner, MPT2006.

  9. #19
    lez
    lez is offline
    FLAC lez's Avatar
    Join Date
    Jan 2004
    Location
    UK
    Posts
    1,334
    Well I tried it and it works, but not right, seems XPdoes not support 'else', only 'if'

    Bit of an oddity, an if but no else, like they left in pause but removed choice (the command, thats not an intentional XP pun!)

  10. #20
    FLAC
    Join Date
    Sep 2004
    Posts
    1,577
    I'm guessing you reformatted the file to move the else onto a separate line? else is supported just fine as long as you follow the rules:
    The ELSE clause must occur on the same line as the command after the IF. For example:
    IF EXIST filename. (
    del filename.
    ) ELSE (
    echo filename. missing.
    )
    Progress: 80% - Permanent install left.
    Motion LS800 Tablet PC and dock.
    Vista, Bu-535 GPS, RoadRunner, MPT2006.

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Help needed choosing software
    By sremick in forum GPS
    Replies: 0
    Last Post: 10-26-2004, 11:37 AM
  2. Wifi software???
    By Rafster in forum Software & Software Development
    Replies: 8
    Last Post: 04-16-2004, 12:06 AM
  3. fs/ft datalogger card and software
    By indysho90 in forum Classified Archive
    Replies: 1
    Last Post: 08-13-2003, 11:34 AM
  4. Shortcut software needed, could solve problems
    By dudah85 in forum Software & Software Development
    Replies: 2
    Last Post: 09-13-2001, 10:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •