Skip to content

Running multiple copies of the same module #227

Answered by stapelberg
danmcclain asked this question in Q&A
Discussion options

You must be logged in to vote

I’m glad you’re enjoying gokrazy!

The way I currently deal with running multiple instances is by setting "DontStart": true on the module in question (e.g. the RobustIRC bridge), and then having one or more small wrapper programs that start the desired instances:

package main

import (
	"log"
	"os"
	"os/exec"
	"syscall"
)

func main() {
	bridge := exec.Command("/user/robustirc-bridge", "-network=robustirc.net")
	bridge.Stdout = os.Stdout
	bridge.Stderr = os.Stderr
	bridge.Env = []string{} // clear environment
	bridge.SysProcAttr = &syscall.SysProcAttr{
		Credential: &syscall.Credential{
			Uid: 65534, // nobody
			Gid: 65534, // nogroup
		},
	}
	if err := bridge.Run(); err != nil {
		log.F…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by danmcclain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants