shutdown

package
v1.55.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 3 Imported by: 1

README

Package shutdown

Пакет shutdown предназначен для перехвата системных сигналов завершения (SIGINT, SIGTERM) и выполнения заданной пользователем функции при их получении.

Functions

func On(do func()) chan os.Signal

Запускает обработку сигналов завершения процесса (SIGINT, SIGTERM) и вызывает переданную функцию do при получении одного из этих сигналов.

Usage

package main

import (
	"fmt"
	"time"

	"github.com/txix-open/isp-kit/shutdown"
)

func main() {
	shutdown.On(func() {
		fmt.Println("shutting down...")
	})

	fmt.Println("working...")
	time.Sleep(30 * time.Second)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func On

func On(do func()) chan os.Signal

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL