github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/install/windows-service.mdx (about) 1 --- 2 layout: docs 3 page_title: Nomad as a Windows Service 4 sidebar_title: Windows Service 5 description: Discusses how to register and run Nomad as a native Windows service. 6 --- 7 8 # Installing Nomad as a Windows service 9 10 Nomad can be run as a native Windows service. In order to do this, you will need 11 to register the Nomad application with the Windows Service Control Manager using 12 [`sc.exe`], configure Nomad to log to a file, and then start the Nomad service. 13 14 ~> **Note:** These steps should be run in a PowerShell session with Administrator 15 capabilities. 16 17 ## Register Nomad with Windows 18 19 [Download] the Nomad binary for your architecture. 20 21 Use the [`sc.exe`] command to create a Service named "Nomad". The binPath 22 argument should include the fully qualified path to the Nomad executable and any 23 arguments to the nomad command: agent, -config, etc. 24 25 ```plaintext 26 sc.exe create "Nomad" binPath="«full path to nomad.exe» agent -config=«path to config file or directory»" start= auto 27 [SC] CreateService SUCCESS 28 ``` 29 30 If you receive a success message, your service is registered with the service 31 manager. 32 33 If you get an error, please verify the path to the binary and check the 34 arguments, by running the contents of `binPath` directly in a PowerShell session 35 and observing the results. 36 37 ## Configure Nomad to log to file 38 39 Because Windows services run non-interactively and Nomad does not log to the 40 Windows Event Viewer, you will need to configure file-based logging in Nomad. 41 42 To do this, set the [`log_file`][logging] argument in your Nomad configuration 43 file or in the binPath argument of the [`sc.exe`] command used to register the 44 service. 45 46 ## Start the Nomad service 47 48 You have two ways to start the service. 49 50 - Go to the Windows Service Manager, and look for **Nomad** in the service name 51 column. Click the _Start_ button to start the service. 52 53 - Using the [`sc.exe`] command: 54 55 ```plaintext 56 sc.exe start "Nomad" 57 58 SERVICE_NAME: Nomad 59 TYPE : 10 WIN32_OWN_PROCESS 60 STATE : 4 RUNNING 61 (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN) 62 WIN32_EXIT_CODE : 0 (0x0) 63 SERVICE_EXIT_CODE : 0 (0x0) 64 CHECKPOINT : 0x0 65 WAIT_HINT : 0x0 66 PID : 8008 67 FLAGS : 68 ``` 69 70 The service automatically starts up during/after boot, so you don't need to 71 launch Nomad from the command-line again. 72 73 [`sc.exe`]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682107(v=vs.85).aspx 74 [download]: /downloads 75 [logging]: /docs/configuration#log_file