Changes between Initial Version and Version 1 of IntegratingOpenvpnWithNssm


Ignore:
Timestamp:
06/22/15 13:40:09 (9 years ago)
Author:
Samuli Seppänen
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IntegratingOpenvpnWithNssm

    v1 v1  
     1= Integrating OpenVPN with NSSM =
     2
     3[http://nssm.cc/ NSSM] ("Non-sucking Service Manager") is a public domain service manager for Windows. It tries to ensure that processes launched by it are respawned should they die. In addition it can write processes' output into logfiles and manage log rotation, among other things. For details have a look at the [http://nssm.cc/ NSSM website] and the ''README.txt'' file bundled in the nssm zip-file.
     4
     5= Installing NSSM =
     6
     7NSSM is distributed as a zipfile which contains binaries for 32- and 64-bit Windows. To install nssm.exe just extract the zip-file and copy the appropriate executable somewhere in the path, e.g. ''C:\Program Files\OpenVPN\bin''.
     8 
     9= Adding an OpenVPN connection to NSSM =
     10
     11Making NSSM monitor an OpenVPN connection is quite straightforward:
     12
     13{{{
     14set BASEDIR=C:\Program Files\OpenVPN
     15set NSSM=%BASEDIR%\bin\nssm.exe
     16set CONN=community.ovpn
     17
     18"%NSSM%" status %CONN% > NUL 2>&1
     19if %ERRORLEVEL% EQU 3 (
     20    "%NSSM%" install %CONN% "%BASEDIR%\bin\openvpn.exe" > NUL 2>&1
     21)
     22
     23"%NSSM%" set %CONN% AppDirectory "%BASEDIR%\config" > NUL 2>&1
     24"%NSSM%" set %CONN% AppParameters "--config %CONN%" > NUL 2>&1
     25"%NSSM%" set %CONN% AppStdin "%BASEDIR%\log\%CONN%.log" > NUL 2>&1
     26"%NSSM%" set %CONN% AppStdout "%BASEDIR%\log\%CONN%.log" > NUL 2>&1
     27"%NSSM%" set %CONN% AppStderr "%BASEDIR%\log\%CONN%.log" > NUL 2>&1
     28"%NSSM%" set %CONN% AppRotateFiles 1 > NUL 2>&1
     29"%NSSM%" set %CONN% DependOnService Dhcp tap0901 > NUL 2>&1
     30"%NSSM%" start %CONN% > NUL 2>&1
     31}}}
     32
     33The CONN variable refers to the OpenVPN connection file you wish to launch.
     34
     35= Acknowledgements =
     36
     37Thanks to Jason Haar for providing the initial version of the above script!