Upstart-initiated job is not launching as I expect, hangs instead

J.B. Nicholson-Owens jbn at illinois.edu
Thu Jan 6 23:10:07 UTC 2011


I'm new to Upstart and I've written the following Upstart job:

================================
#
# Start the radmind server as the "radmind" user, creating the
# user if necessary.
#
description "radmind server"
author "J.B. Nicholson-Owens <jbn at illinois.edu>"
version "1.0"

start on network-up
stop on network-down

expect fork

pre-start script
         # If the user "radmind" does not exist, create a "radmind" user.
         # We don't care what UID this user gets.
         radmind_user_exists=`grep '^radmind:' /etc/passwd | wc -l`
         logger -t radmind "${radmind_user_exists} radmind users exist 
on this machine."

         if [ ${radmind_user_exists} -eq 0 ]; then
                 su --command "useradd --comment 'radmind server user' 
--user-group --create-home"
                 logger -t radmind "created radmind user"
                 su --command "usermod --expiredate 1 --lock radmind"
                 logger -t radmind "modified radmind user"
         fi
end script

script
         # launch the server process.
         logger -t radmind "launching radmind process"
         su --command /usr/sbin/radmind radmind
end script
==============================

I thought the job would begin the instant I saved it (globally-readable, 
root-writable) as /etc/init/radmind.conf but that didn't happen (as far 
as I know).

When I tried to start the job with initctl:

$ sudo initctl start radmind
[sudo] password for administrator:
initctl: Job is already running: radmind
$ sudo initctl stop radmind

Here initctl never returns.

I'm doing something wrong, obviously, but it's not clear to me what I'm 
doing wrong.

Any help would be appreciated.

Thanks.
-- 
J.B. Nicholson-Owens, Website and Network Administrator



More information about the upstart-devel mailing list