@@ -167,42 +167,70 @@ func New(i Interface, c *Config) (Service, error) {
167
167
}
168
168
169
169
// KeyValue provides a list of system specific options.
170
- // * OS X
171
- // - LaunchdConfig string () - Use custom launchd config.
172
- // - KeepAlive bool (true) - Prevent the system from stopping the service automatically.
173
- // - RunAtLoad bool (false) - Run the service after its job has been loaded.
174
- // - SessionCreate bool (false) - Create a full user session.
175
- //
176
- // * Solaris
177
- // - Prefix string ("application") - Service FMRI prefix.
178
- //
179
- // * POSIX
180
- // - UserService bool (false) - Install as a current user service.
181
- // - SystemdScript string () - Use custom systemd script.
182
- // - UpstartScript string () - Use custom upstart script.
183
- // - SysvScript string () - Use custom sysv script.
184
- // - OpenRCScript string () - Use custom OpenRC script.
185
- // - RunWait func() (wait for SIGNAL) - Do not install signal but wait for this function to return.
186
- // - ReloadSignal string () [USR1, ...] - Signal to send on reload.
187
- // - PIDFile string () [/run/prog.pid] - Location of the PID file.
188
- // - LogOutput bool (false) - Redirect StdErr & StandardOutPath to files.
189
- // - Restart string (always) - How shall service be restarted.
190
- // - SuccessExitStatus string () - The list of exit status that shall be considered as successful,
191
- // in addition to the default ones.
192
- // - LogDirectory string(/var/log) - The path to the log files directory
193
- //
194
- // * Linux (systemd)
195
- // - LimitNOFILE int (-1) - Maximum open files (ulimit -n)
196
- // (https://serverfault.com/questions/628610/increasing-nproc-for-processes-launched-by-systemd-on-centos-7)
197
- // * Windows
198
- // - DelayedAutoStart bool (false) - After booting, start this service after some delay.
199
- // - Password string () - Password to use when interfacing with the system service manager.
200
- // - Interactive bool (false) - The service can interact with the desktop. (more information https://docs.microsoft.com/en-us/windows/win32/services/interactive-services)
201
- // - DelayedAutoStart bool (false) - after booting start this service after some delay.
202
- // - StartType string ("automatic") - Start service type. (automatic | manual | disabled)
203
- // - OnFailure string ("restart" ) - Action to perform on service failure. (restart | reboot | noaction)
204
- // - OnFailureDelayDuration string ( "1s" ) - Delay before restarting the service, time.Duration string.
205
- // - OnFailureResetPeriod int ( 10 ) - Reset period for errors, seconds.
170
+ //
171
+ // - OS X
172
+ //
173
+ // - LaunchdConfig string () - Use custom launchd config.
174
+ //
175
+ // - KeepAlive bool (true) - Prevent the system from stopping the service automatically.
176
+ //
177
+ // - RunAtLoad bool (false) - Run the service after its job has been loaded.
178
+ //
179
+ // - SessionCreate bool (false) - Create a full user session.
180
+ //
181
+ // - Solaris
182
+ //
183
+ // - Prefix string ("application") - Service FMRI prefix.
184
+ //
185
+ // - POSIX
186
+ //
187
+ // - UserService bool (false) - Install as a current user service.
188
+ //
189
+ // - SystemdScript string () - Use custom systemd script.
190
+ //
191
+ // - UpstartScript string () - Use custom upstart script.
192
+ //
193
+ // - SysvScript string () - Use custom sysv script.
194
+ //
195
+ // - OpenRCScript string () - Use custom OpenRC script.
196
+ //
197
+ // - RunWait func() (wait for SIGNAL) - Do not install signal but wait for this function to return.
198
+ //
199
+ // - ReloadSignal string () [USR1, ...] - Signal to send on reload.
200
+ //
201
+ // - PIDFile string () [/run/prog.pid] - Location of the PID file.
202
+ //
203
+ // - LogOutput bool (false) - Redirect StdErr & StandardOutPath to files.
204
+ //
205
+ // - Restart string (always) - How shall service be restarted.
206
+ //
207
+ // - SuccessExitStatus string () - The list of exit status that shall be considered as successful,
208
+ // in addition to the default ones.
209
+ //
210
+ // - LogDirectory string(/var/log) - The path to the log files directory
211
+ //
212
+ // - Linux (systemd)
213
+ //
214
+ // - LimitNOFILE int (-1) - Maximum open files (ulimit -n)
215
+ // (https://serverfault.com/questions/628610/increasing-nproc-for-processes-launched-by-systemd-on-centos-7)
216
+ //
217
+ // - Windows
218
+ //
219
+ // - DelayedAutoStart bool (false) - After booting, start this service after some delay.
220
+ //
221
+ // - Password string () - Password to use when interfacing with the system service manager.
222
+ //
223
+ // - Interactive bool (false) - The service can interact with the desktop. (more information https://docs.microsoft.com/en-us/windows/win32/services/interactive-services)
224
+ //
225
+ // - DelayedAutoStart bool (false) - after booting start this service after some delay.
226
+ //
227
+ // - StartType string ("automatic") - Start service type. (automatic | manual | disabled)
228
+ //
229
+ // - OnFailure string ("restart" ) - Action to perform on service failure. (restart | reboot | noaction)
230
+ //
231
+ // - OnFailureDelayDuration string ( "1s" ) - Delay before restarting the service, time.Duration string.
232
+ //
233
+ // - OnFailureResetPeriod int ( 10 ) - Reset period for errors, seconds.
206
234
type KeyValue map [string ]interface {}
207
235
208
236
// bool returns the value of the given name, assuming the value is a boolean.
@@ -325,16 +353,16 @@ type System interface {
325
353
// Interface represents the service interface for a program. Start runs before
326
354
// the hosting process is granted control and Stop runs when control is returned.
327
355
//
328
- // 1. OS service manager executes user program.
329
- // 2. User program sees it is executed from a service manager (IsInteractive is false).
330
- // 3. User program calls Service.Run() which blocks.
331
- // 4. Interface.Start() is called and quickly returns.
332
- // 5. User program runs.
333
- // 6. OS service manager signals the user program to stop.
334
- // 7. Interface.Stop() is called and quickly returns.
335
- // - For a successful exit, os.Exit should not be called in Interface.Stop().
336
- // 8. Service.Run returns.
337
- // 9. User program should quickly exit.
356
+ // 1. OS service manager executes user program.
357
+ // 2. User program sees it is executed from a service manager (IsInteractive is false).
358
+ // 3. User program calls Service.Run() which blocks.
359
+ // 4. Interface.Start() is called and quickly returns.
360
+ // 5. User program runs.
361
+ // 6. OS service manager signals the user program to stop.
362
+ // 7. Interface.Stop() is called and quickly returns.
363
+ // - For a successful exit, os.Exit should not be called in Interface.Stop().
364
+ // 8. Service.Run returns.
365
+ // 9. User program should quickly exit.
338
366
type Interface interface {
339
367
// Start provides a place to initiate the service. The service doesn't
340
368
// signal a completed start until after this function returns, so the
0 commit comments