transmission_of_audio_and_video:audio_and_video
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| transmission_of_audio_and_video:audio_and_video [2025/12/25 20:12] – aperez | transmission_of_audio_and_video:audio_and_video [2025/12/25 20:42] (current) – aperez | ||
|---|---|---|---|
| Line 15: | Line 15: | ||
| - | ====== Arranque Automático de Aplicación Java (VisionLite) como Servicio en Windows ====== | ||
| - | ===== Objetivo ===== | ||
| - | Configurar la aplicación Java **VisionLite** para que se ejecute automáticamente cada vez que el servidor Windows inicia, sin depender del inicio de sesión de un usuario, utilizando **NSSM (Non-Sucking Service Manager)**. | ||
| - | La aplicación se ejecuta originalmente con el comando: | + | |
| + | ====== Automatic Startup of Java Application (VisionLite) as a Windows Service ====== | ||
| + | |||
| + | ===== Purpose ===== | ||
| + | Establish a standard, reproducible, | ||
| + | application as a **Windows Service**, ensuring: | ||
| + | |||
| + | * Automatic startup when the server boots | ||
| + | * Independence from user login | ||
| + | * Automatic restart on failures | ||
| + | * Use of standard production paths | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Scenario ===== | ||
| + | Java application manually executed with: | ||
| < | < | ||
| java -jar VLite_2_3_169.jar | java -jar VLite_2_3_169.jar | ||
| </ | </ | ||
| + | |||
| + | Requirement: | ||
| + | The application must start automatically after every operating system reboot. | ||
| --- | --- | ||
| - | ===== Requisitos Previos | + | ===== Requirements |
| - | * Sistema operativo: | + | * Windows Server |
| - | * Java instalado | + | * PowerShell with administrative privileges |
| - | * NSSM instalado | + | * Internet connectivity |
| - | * Acceso administrativo al servidor | + | * Java Runtime Environment |
| + | * NSSM (Non-Sucking Service Manager) | ||
| --- | --- | ||
| - | ===== Verificación de Java ===== | + | ===== Step 1 — Chocolatey Installation |
| - | Confirmar que Java está instalado y funcional: | + | Chocolatey is the standard Windows package manager. |
| + | ==== Verification ==== | ||
| <code powershell> | <code powershell> | ||
| - | java -version | + | choco -v |
| </ | </ | ||
| - | Salida esperada | + | ==== Installation |
| + | <code powershell> | ||
| + | Set-ExecutionPolicy Bypass -Scope Process -Force | ||
| + | [System.Net.ServicePointManager]:: | ||
| + | iex ((New-Object System.Net.WebClient).DownloadString(' | ||
| + | </ | ||
| + | |||
| + | Close and reopen PowerShell. | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 2 — Java Installation and Verification ===== | ||
| + | Java LTS is recommended (Java 8 or 11). | ||
| + | |||
| + | ==== Java 8 Installation ==== | ||
| + | <code powershell> | ||
| + | choco install jre8 -y | ||
| + | </ | ||
| + | |||
| + | ==== Verification ==== | ||
| + | <code powershell> | ||
| + | java -version | ||
| + | </ | ||
| + | Validated output in this environment: | ||
| < | < | ||
| java version " | java version " | ||
| - | Java(TM) SE Runtime Environment | ||
| </ | </ | ||
| --- | --- | ||
| - | ===== Identificación de la Ruta REAL de Java ===== | + | ===== Step 3 — Identifying the REAL Java Path ===== |
| - | Es importante usar el binario real de Java y no el wrapper | + | ⚠️ Do NOT use the wrapper: |
| + | < | ||
| + | C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe | ||
| + | </ | ||
| + | ==== Validate the real binary ==== | ||
| <code powershell> | <code powershell> | ||
| Test-Path " | Test-Path " | ||
| </ | </ | ||
| - | Resultado esperado: | + | Result: |
| < | < | ||
| True | True | ||
| </ | </ | ||
| - | Ruta confirmada de Java: | + | Confirmed path: |
| < | < | ||
| C:\Program Files\Java\jre1.8.0_261\bin\java.exe | C:\Program Files\Java\jre1.8.0_261\bin\java.exe | ||
| Line 71: | Line 114: | ||
| --- | --- | ||
| - | ===== Instalación de NSSM ===== | + | ===== Step 4 — NSSM Installation |
| - | (Usando Chocolatey) | + | NSSM allows applications to run as controlled Windows services. |
| + | ==== Installation ==== | ||
| <code powershell> | <code powershell> | ||
| choco install nssm -y | choco install nssm -y | ||
| </ | </ | ||
| - | Verificación: | + | ==== Verification ==== |
| <code powershell> | <code powershell> | ||
| nssm version | nssm version | ||
| Line 86: | Line 129: | ||
| --- | --- | ||
| - | ===== Verificación del Servicio | + | ===== Step 5 — Service Verification |
| - | Comprobar si el servicio ya existe: | + | Check whether the service already exists: |
| <code powershell> | <code powershell> | ||
| Line 93: | Line 136: | ||
| </ | </ | ||
| - | Resultado esperado: | + | Validated result: |
| < | < | ||
| Name DisplayName | Name DisplayName | ||
| Line 101: | Line 144: | ||
| --- | --- | ||
| - | ===== Configuración del Servicio | + | ===== Step 6 — VisionLite |
| - | Ejecutar todos los comandos en **PowerShell | + | All commands must be executed in **PowerShell |
| - | ==== Definición del ejecutable | + | ==== Java executable definition |
| <code powershell> | <code powershell> | ||
| nssm set VisionLite Application " | nssm set VisionLite Application " | ||
| </ | </ | ||
| - | ==== Parámetros del JAR ==== | + | ==== Execution parameters |
| <code powershell> | <code powershell> | ||
| nssm set VisionLite AppParameters "-jar VLite_2_3_169.jar" | nssm set VisionLite AppParameters "-jar VLite_2_3_169.jar" | ||
| </ | </ | ||
| - | ==== Directorio de trabajo (CRÍTICO) | + | ==== Initial working directory |
| - | Este directorio debe contener el JAR y sus carpetas asociadas. | + | |
| <code powershell> | <code powershell> | ||
| nssm set VisionLite AppDirectory " | nssm set VisionLite AppDirectory " | ||
| </ | </ | ||
| - | ==== Arranque automático | + | ==== Automatic startup |
| <code powershell> | <code powershell> | ||
| nssm set VisionLite Start SERVICE_AUTO_START | nssm set VisionLite Start SERVICE_AUTO_START | ||
| </ | </ | ||
| - | ==== Reinicio automático si falla ==== | + | ==== Automatic restart on failure |
| <code powershell> | <code powershell> | ||
| nssm set VisionLite AppExit Default Restart | nssm set VisionLite AppExit Default Restart | ||
| Line 134: | Line 175: | ||
| --- | --- | ||
| - | ===== Inicio del Servicio | + | ===== Step 7 — Service Start and Validation |
| <code powershell> | <code powershell> | ||
| nssm start VisionLite | nssm start VisionLite | ||
| - | </ | ||
| - | |||
| - | Verificación: | ||
| - | |||
| - | <code powershell> | ||
| sc query VisionLite | sc query VisionLite | ||
| </ | </ | ||
| - | Estado esperado: | + | Validated state: |
| < | < | ||
| STATE : 4 RUNNING | STATE : 4 RUNNING | ||
| </ | </ | ||
| - | --- | + | ==== Auto-start confirmation |
| - | + | ||
| - | ===== Confirmación de Arranque Automático ===== | + | |
| <code powershell> | <code powershell> | ||
| sc qc VisionLite | sc qc VisionLite | ||
| </ | </ | ||
| - | Resultado esperado: | + | Result: |
| < | < | ||
| START_TYPE : 2 AUTO_START | START_TYPE : 2 AUTO_START | ||
| Line 164: | Line 198: | ||
| --- | --- | ||
| - | ===== Validación de Configuración (Dump NSSM) ===== | + | ===== Step 8 — Best Practice Correction |
| - | Permite revisar toda la configuración efectiva del servicio: | + | A user Desktop–based path is **NOT recommended** for production. |
| - | < | + | ==== Standard path defined ==== |
| - | nssm dump VisionLite | + | < |
| + | C: | ||
| </ | </ | ||
| --- | --- | ||
| - | ===== Resultado Final ===== | + | ===== Step 9 — Service Migration to Standard Path ===== |
| - | | + | |
| - | * Arranca automáticamente en cada reinicio del servidor | + | ==== Stop the service ==== |
| - | * No depende de login de usuario | + | <code powershell> |
| - | * Se reinicia automáticamente si el proceso Java falla | + | nssm stop VisionLite |
| + | </ | ||
| + | |||
| + | ==== Create production directory ==== | ||
| + | <code powershell> | ||
| + | mkdir C: | ||
| + | </ | ||
| + | |||
| + | ==== Migrate application files ==== | ||
| + | <code powershell> | ||
| + | Move-Item " | ||
| + | </ | ||
| + | |||
| + | ==== Update service working directory ==== | ||
| + | <code powershell> | ||
| + | nssm set VisionLite AppDirectory " | ||
| + | </ | ||
| + | |||
| + | ==== Restart the service ==== | ||
| + | <code powershell> | ||
| + | nssm start VisionLite | ||
| + | sc query VisionLite | ||
| + | </ | ||
| --- | --- | ||
| - | ===== Operación Diaria | + | ===== Step 10 — Final Validation |
| - | Comandos útiles: | + | ==== NSSM configuration dump ==== |
| + | <code powershell> | ||
| + | nssm dump VisionLite | ||
| + | </ | ||
| + | |||
| + | Confirm: | ||
| + | < | ||
| + | AppDirectory C: | ||
| + | </ | ||
| + | |||
| + | ==== Recommended test ==== | ||
| + | Reboot the server and verify the service is in RUNNING state. | ||
| + | |||
| + | --- | ||
| + | ===== Daily Operations ===== | ||
| <code powershell> | <code powershell> | ||
| nssm start VisionLite | nssm start VisionLite | ||
| Line 193: | Line 264: | ||
| --- | --- | ||
| - | ===== Nota Técnica | + | ===== Troubleshooting |
| - | A partir de esta configuración, | + | ^ Symptom ^ Probable cause ^ Corrective action ^ |
| + | | Service stops | Incorrect directory | Verify AppDirectory | | ||
| + | | JAR does not start | Incorrect Java path | Validate real java.exe | | ||
| + | | Does not start after reboot | Not AUTO_START | Verify sc qc | | ||
| + | | Files not found | Relative paths | Use standard path | | ||
| + | --- | ||
| + | |||
| + | ===== Best Practices ===== | ||
| + | * Use `C: | ||
| + | * Avoid user-profile-dependent paths | ||
| + | * Document changes in Wiki | ||
| + | * Centralize management with NSSM | ||
| + | * Consider a dedicated service account for critical services | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Final Note ===== | ||
| + | Once configured as a service: | ||
| + | |||
| + | ❌ DO NOT manually execute: | ||
| < | < | ||
| java -jar VLite_2_3_169.jar | java -jar VLite_2_3_169.jar | ||
| </ | </ | ||
| - | Toda la gestión debe realizarse | + | ✅ Manage exclusively as a Windows service. |
| --- | --- | ||
| - | **Autor:** Antonio Pérez | + | |
| - | **Rol:** Network Engineer | + | <code powershell> |
| + | nssm stop VisionLite | ||
| + | sc query VisionLite | ||
| + | |||
| + | nssm set VisionLite Application "C:\Program Files\Java\jre1.8.0_261\bin\java.exe" | ||
| + | nssm set VisionLite AppParameters "-jar VLite_2_3_169.jar" | ||
| + | nssm set VisionLite AppDirectory "C:\Services\VisionLite" | ||
| + | nssm set VisionLite Start SERVICE_AUTO_START | ||
| + | nssm set VisionLite AppExit Default Restart | ||
| + | nssm set VisionLite AppRestartDelay 60000 | ||
| + | |||
| + | nssm start VisionLite | ||
| + | sc query VisionLite | ||
| + | |||
| + | sc qc VisionLite | ||
| + | |||
| + | nssm dump VisionLite | ||
| + | |||
| + | nssm start VisionLite | ||
| + | nssm stop VisionLite | ||
| + | nssm restart VisionLite | ||
| + | sc query VisionLite | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
transmission_of_audio_and_video/audio_and_video.1766693544.txt.gz · Last modified: by aperez
