-
Notifications
You must be signed in to change notification settings - Fork 28
More systemd friendly? #72
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
base: master
Are you sure you want to change the base?
Conversation
anjohnson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels yucky.
This is partly why we use Makefiles to generate systemd.unit files from templates, using envsubst to expand them.
| // reallocate argv[] storage, and expand any unexpanded arguments | ||
| std::vector<std::string> argvStore; | ||
| for(char** av = childArgv; *av; av++) { | ||
| if((*av)[0]=='$') { // expand command from environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for this needs to point out that it only accepts environment variables as a complete argument. As implemented an argument can't have a variable somewhere in the middle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is enough interest, I would implement shell style unquoting and argument splitting.
I have seen (and been responsible for) several variations on this theme. Not least the Still, this PR would not make these scripts go away. Only to reduce the content emitted to shorter |
|
Another idea. Using |
Oh my. That sounds like the next generation of the CA Gateway's killer and restart scripts... (It's a one-off and considerably different, I know.) To be honest, I'd rather go (same for the Gateway, btw.) for a configuration file containing One could find a generic C++ class that works for both procServ and the Gateway. |
A half-baked idea for how to make procServ, with its long argument lists, friendlier for use with systemd. Since systemd does not expand environment variables in
ExecStart=, teach procServ to do so.eg.
/etc/systemd/system/procServ@.serviceThis allows a unit override file to change only
$PROCCMDwithout needing to repeat the whole longExecStart=.eg.
/etc/systemd/system/procServ@foo.service/override.confWould be a more concise expression of what, where, and who.
I'm not sure what the semantics would be to handle command arguments. As written, this PR expands one environment variable as one argument. eg
PROCCMD=foo barwouldexec "foo bar"instead ofexec "foo" "bar"as might be expected.Maybe a better way would be to do indirection for procServ argument values, and add a new argument for the un-split command? eg.