2

I write my C++ program and run it as daemon by writing upstart script inside /etc/init/

So my program is automatically started after reboot and can be controlled using sudo service my-service restart

How to allow to restart this service from another non-admin user (that is jenkins integration server)?

At present if my jenkins runs script

service my-service start

it gives me an error: my-service: unrecognized service

Roman Kolesnikov
  • 163
  • 1
  • 1
  • 4
  • 1
    You should probably use "sudo service... "? – Patrice M. Mar 09 '16 at 06:56
  • I don't think it's an option because this script runs in non-interactive mode and I do not want jenkins to run any commands as root – Roman Kolesnikov Mar 09 '16 at 12:24
  • Normally on Linux, 'service' has to run as root, even when the script ends up using alternate credentials to start the actual process(es). 'sudo' can be configured to run without prompting for credentials also. – Patrice M. Mar 09 '16 at 15:33
  • Isn't most services in linux like nginx, postgresql etc run under their own users? May be its possible somehow to signal to restart service? – Roman Kolesnikov Mar 10 '16 at 17:51
  • Maybe, but idk... And your system may allow running 'serice' as non-root already. Now, maybe we're going on a tangent here: your original issue with that it reports not recognizing your service name. Maybe you could try it as root: if you get the same result, then my comments are moot. – Patrice M. Mar 11 '16 at 14:31

0 Answers0