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

pidfile support for minion and master daemons #563

Closed
chutz opened this issue Jan 24, 2012 · 11 comments
Closed

pidfile support for minion and master daemons #563

chutz opened this issue Jan 24, 2012 · 11 comments
Milestone

Comments

@chutz
Copy link

chutz commented Jan 24, 2012

Hi, I am working on a Gentoo package, and as such I am making init scripts for the minion and master daemons. Without an option for a pid file, it's a little tricky to write a proper working init script.

Probably the most straightforward approach is to add a --pidfile option to give the location to write the file.

@thatch45
Copy link
Contributor

Hi chutz, that is an easy request, I will get it into the next release

@chutz
Copy link
Author

chutz commented Jan 24, 2012

Thanks, let me know once it's in git so I can pull the patch and apply it in the ebuild. That way I can finish up the init scripts and add it to Gentoo right away.

@thatch45
Copy link
Contributor

Will do, we want to be in portage!

@SEJeff
Copy link
Contributor

SEJeff commented Jan 24, 2012

Just curious, how do you do this on gentoo for multiple pids? The master generally starts multiple worker processes and they each have different pids. Do you just put the parent's pid in the pidfile or all of them?

@chutz
Copy link
Author

chutz commented Jan 24, 2012

Generally you just put the master's PID in the file, then have the master make sure that all the children are terminated before it terminates.

@thatch45
Copy link
Contributor

thatch45 commented Feb 7, 2012

I am having an issue cleanly killing all the children, the pidfile now has all master process pids

@SEJeff
Copy link
Contributor

SEJeff commented Feb 7, 2012

Tom: Perhaps you should just get the process group id, and then intercept the SIGTERM from the parent salt-master daemon and send the entire process group a SIGTERM? You should be able to do it all (in theory) using os.getpgrp() and os.killpgid() on POSIX-like systems.

I know in non-python shell scripts, this is how I would do it. Use ps magic to get the process group id and then send a signal to the entire process group instead of individual pids.

@thatch45
Copy link
Contributor

thatch45 commented Feb 7, 2012

Good call, I had not tried this approach yet, I had been trying to manage the multiprocesses when catching the signal, I will give this a shot, thanks!

Yes, we do want the master to clean the children!

@SEJeff
Copy link
Contributor

SEJeff commented Feb 7, 2012

Yeah this should work. It is the "proper" way to do this sort of thing on Linux at least.

@thatch45
Copy link
Contributor

We have updated this all to have a single pid in pidfiles and for the main pid on the master to cleanly kill all the other processes. IS this still an issue?

@SEJeff
Copy link
Contributor

SEJeff commented Mar 18, 2012

Should be fixed in git and will be in 0.9.8

@SEJeff SEJeff closed this as completed Mar 18, 2012
arthurzenika pushed a commit to arthurzenika/salt that referenced this issue Sep 17, 2013
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