Hi Stuart,

On Fri, Jan 31, 2014 at 05:38:42PM -0800, Stuart Knightley wrote:

> I have an upstart script with setuid, and a pre-start script that I wish
> to call `stop` in.  However the user I've changed to does not have
> permission to call stop.  I realise that I can exit with a non-zero status
> but the previous thread on this mailing list indicates this is not best
> practice.

> Does anyone have any suggestions? 

In general, anything you can do in a {pre,post}-{start,stop} script, you can
also do in a separate job with a 'start on {start,stopp}{ed,ing}' rule.  And
in a case such as this where you are running the main job under some sort of
access controls, this is what you need to do.

Something like the following should work:

start on starting main_job
script
    if $condition; then
        stop main_job
    fi
end script

Hope that helps,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
[email protected]                                     [email protected]

Attachment: signature.asc
Description: Digital signature

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to