| | 34 | |
| | 35 | |
| | 36 | == Updating NSClient++ == |
| | 37 | This set of script will allow you to sync your files from a centralize share to your NSCliet++ install folder with logging info. After a successful copy, it will launch another batch script instance (reload.bat) to restart the NSClient++ service for the changes to take effect. [[BR]] |
| | 38 | |
| | 39 | '''Place both of these scripts in the script folder and create an entry in your NSC.ini for them. Make sure you modify the source variable to reflect your central share.''' |
| | 40 | |
| | 41 | '''update.bat''' |
| | 42 | {{{ |
| | 43 | @echo off |
| | 44 | @setlocal enableextensions |
| | 45 | @cd /d "%~dp0" |
| | 46 | |
| | 47 | REM Variables |
| | 48 | set source=\\your\share |
| | 49 | set rev=1.0 |
| | 50 | |
| | 51 | REM Copying scripts |
| | 52 | echo %date%-%time% >> check_script_update.log |
| | 53 | copy "%source%\scripts\*.*" "%PROGRAMFILES%\NSClient++\scripts" /y >> check_script_update.log |
| | 54 | copy "%source%\*.*" "%PROGRAMFILES%\NSClient++\" /y >> check_script_update.log |
| | 55 | CLS |
| | 56 | @echo off |
| | 57 | |
| | 58 | IF ERRORLEVEL 1 GOTO err |
| | 59 | IF ERRORLEVEL 0 GOTO ok |
| | 60 | GOTO unknown |
| | 61 | |
| | 62 | :err |
| | 63 | echo CRITICAL: Script copy failed: rev %rev% |
| | 64 | exit /B 1 |
| | 65 | |
| | 66 | :unknown |
| | 67 | echo UNKNOWN: Something went wrong: rev %rev% |
| | 68 | exit /B 3 |
| | 69 | |
| | 70 | :ok |
| | 71 | echo OK: Script copy succeeded: rev %rev% |
| | 72 | start reload.bat |
| | 73 | exit /B 0 |
| | 74 | }}} |
| | 75 | |
| | 76 | '''reload.bat''' |
| | 77 | {{{ |
| | 78 | @echo off |
| | 79 | @setlocal enableextensions |
| | 80 | @cd /d "%~dp0" |
| | 81 | |
| | 82 | "%PROGRAMFILES%\NSClient++\nsclient++.exe" -stop |
| | 83 | "%PROGRAMFILES%\NSClient++\nsclient++.exe" -start |
| | 84 | EXIT |
| | 85 | }}} |