All Projects → sevlyar → Go Daemon

sevlyar / Go Daemon

Licence: mit
A library for writing system daemons in golang.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Daemon

Kiwix Tools
Command line Kiwix tools: kiwix-serve, kiwix-manage, ...
Stars: ✭ 139 (-89.63%)
Mutual labels:  daemon, library
Usbmuxd
A socket daemon to multiplex connections from and to iOS devices
Stars: ✭ 847 (-36.84%)
Mutual labels:  daemon, library
Whatpulse
WhatPulse reverse engineered
Stars: ✭ 30 (-97.76%)
Mutual labels:  daemon, library
Faast.js
Serverless batch computing made simple.
Stars: ✭ 1,323 (-1.34%)
Mutual labels:  library
Pdf Annotate
Pure-python library for adding annotations to PDFs
Stars: ✭ 94 (-92.99%)
Mutual labels:  library
Redocx
📄 Create word documents with React
Stars: ✭ 1,331 (-0.75%)
Mutual labels:  library
Easyddns
Easy to Use ESP8266 DDNS Update Client Library.
Stars: ✭ 96 (-92.84%)
Mutual labels:  library
Amazon Alexa Php
Php library for amazon echo (alexa) skill development.
Stars: ✭ 93 (-93.06%)
Mutual labels:  library
Chemfiles
Library for reading and writing chemistry files
Stars: ✭ 95 (-92.92%)
Mutual labels:  library
Soundcloud
Soundcloud.com API wrapper written in PHP with OAuth2 support.
Stars: ✭ 94 (-92.99%)
Mutual labels:  library
Libkeepass
Python module to read KeePass 1.x/KeePassX (v3) and KeePass 2.x (v4) files
Stars: ✭ 94 (-92.99%)
Mutual labels:  library
Libsphinx
Sphinx-based Password Storage low-level library
Stars: ✭ 94 (-92.99%)
Mutual labels:  library
Zui
⬢ Zsh User Interface library – CGI+DHTML-like rapid application development with Zsh
Stars: ✭ 95 (-92.92%)
Mutual labels:  library
Grapesjs React
A React wrapper for GrapesJS library
Stars: ✭ 93 (-93.06%)
Mutual labels:  library
Cachectl
Page cache controller for regular file in Go
Stars: ✭ 95 (-92.92%)
Mutual labels:  daemon
Library
A collection of various articles and books I've are worth revisiting.
Stars: ✭ 93 (-93.06%)
Mutual labels:  library
Simpledialogfragments
A collection of easy to use and extendable DialogFragment's for Android
Stars: ✭ 94 (-92.99%)
Mutual labels:  library
Logsip
A simple, concise, colorful logger for Go
Stars: ✭ 94 (-92.99%)
Mutual labels:  library
Cocsharp
Clash of Clans library, proxy and server written in .NET [Unmaintained]
Stars: ✭ 94 (-92.99%)
Mutual labels:  library
Argumentum
C++ command line parsing library
Stars: ✭ 92 (-93.14%)
Mutual labels:  library

go-daemon Build Status GoDoc

Library for writing system daemons in Go.

Now supported only UNIX-based OS (Windows is not supported). But the library was tested only on Linux and OSX, so that if you have an ability to test the library on other platforms, give me feedback, please (#26).

Please, feel free to send me bug reports and fixes. Many thanks to all contributors.

Features

  • Goroutine-safe daemonization;
  • Out of box work with pid-files;
  • Easy handling of system signals;
  • The control of a daemon.

Installation

go get github.com/sevlyar/go-daemon

You can use gopkg.in:

go get gopkg.in/sevlyar/go-daemon.v0

If you want to use the library in production project, please use vendoring, because i can not ensure backward compatibility before release v1.0.

Examples

Documentation

godoc.org/github.com/sevlyar/go-daemon

How it works

We can not use fork syscall in Golang's runtime, because child process doesn't inherit threads and goroutines in that case. The library uses a simple trick: it runs its own copy with a mark - a predefined environment variable. Availability of the variable for the process means an execution in the child's copy. So that if the mark is not setted - the library executes parent's operations and runs its own copy with mark, and if the mark is setted - the library executes child's operations:

func main() {
	Pre()

	context := new(Context)
	child, _ := context.Reborn()

	if child != nil {
		PostParent()
	} else {
		defer context.Release()
		PostChild()
	}
}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].