Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to kill parent process from child process. #191

Open
dkarans opened this issue Nov 12, 2019 · 2 comments
Open

Need to kill parent process from child process. #191

dkarans opened this issue Nov 12, 2019 · 2 comments

Comments

@dkarans
Copy link

dkarans commented Nov 12, 2019

I have created service using kardianos package service name is "TestOne" this was running under the Systemd,From "TestOne" had run one child process called "ProcessOne"
Now i am trying to kill "TestOne" from "ProcessOne" . Is this possible?
If it is possible how can i do?

What is "KillMode" option to create service in Systemd.For better understanding refer the below URL

https://www.freedesktop.org/software/systemd/man/systemd.kill.html

Expectation : Need to kill Parent process from child process.

@Aulilino
Copy link

@dkarans What's the meaning of kill "TestOne" from "ProcessOne" ? Does it mean only send SIGTERM to process "TestOne" ?

Besides, do we have plan for supportting "KillMode" in systemd ?

@prochac
Copy link

prochac commented Jan 9, 2023

This could work.

package main

import "os"

func main() {
	parentPid := os.Getppid()
	parent, _ := os.FindProcess(parentPid)
	_ = parent.Kill()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants