Advertisement
Guest User

Untitled

a guest
Jun 7th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. @echo off
  2. cls
  3.  
  4. ::Variables (please modify only if you know what you're doing)
  5. set SSH_User=root
  6. set SSH_Password=jci
  7. set SSH_Command="echo 1 > /sys/class/gpio/Watchdog\ Disable/value"
  8. set PLINKPath="%~d0%~p0bin\PLINK.EXE"
  9. set PingPath="%~d0%~p0bin\Fping.exe"
  10. set CMU_IP=%1
  11.  
  12. ::Ask for IP of CMU if this was not given via CMD argument
  13. if "%CMU_IP%" =="" (
  14. set /p CMU_IP="IP of CMU (e.g. 192.168.168.1): "
  15. )
  16.  
  17. :PingCheckUp
  18. ::Check if CMU IP is reachable via FPING
  19. %PingPath% %CMU_IP% -i -w 1 -n 1 -l >NUL
  20.  
  21. ::If reachable, goto RemoteSSH_Command, otherwise show info and check again immediately
  22. if "%errorlevel%"=="0" (
  23. goto RemoteSSH_Command
  24. ) ELSE (
  25. echo CMU is still offline...%time%
  26. echo.
  27. goto PingCheckUp
  28. )
  29.  
  30. :RemoteSSH_Command
  31. ::Logon and execute SSH command on CMU
  32. %PLINKPath% -v %SSH_User%@%CMU_IP% -pw %SSH_Password% %SSH_Command%
  33.  
  34. ::If execution was successfull, show info. Otherwise restart script.
  35. if "%errorlevel%"=="0" (
  36. echo.
  37. echo It seems like we were able to disable the Infotainment watchdog!
  38. pause
  39. ) ELSE (
  40. echo.
  41. echo Error...restarting script.
  42. echo.
  43. goto PingCheckUp
  44. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement