Ubuntu 10.04
I have created this upstart script (/etc/init/pure-ftpd.conf):
# pure-ftpd - FTP server
description "Pure-FTPd server"
start on filesystem
stop on runlevel S
respawn
respawn limit 10 5
pid file /var/run/pure-ftpd.pid
console output
pre-start script
test -x /usr/local/sbin/pure-ftpd || { stop; exit 0; }
end script
exec /usr/local/sbin/pure-ftpd --maxclientsnumber 2 --maxclientsperip 10 --prohibitdotfileswrite --prohibitdotfilesread --noanonymous --chrooteveryone --dontresolve --nochmod --pidfile /var/run/pure-ftpd.pid
But...
# start pure-ftpd
start: Unknown job: pure-ftpd
and
# service pure-ftpd start
start: Unknown job: pure-ftpd
What's the problem?
Is it necessary to do something more?
Is it necessary to create one script in /etc/init.d too?
You can also run
init-checkconf
to check syntaxIt usually means you have an error in the
.conf
file - for instance I'm not sure thepid
stanza is supported in 10.04,stop
can't be used in the script etc.I'd try starting the file from scratch (with only
start
,stop
etc), and then slowly building it up by adding more and more lines and testing it viastart pure-ftpd
.For example:
First, you can check that your job is actually known to upstart:
...where
your_job_name
is the name of your upstart script minus the.conf
extension.If it's not found, you can try reloading the configuration and then re-checking:
Then try again to start your job:
If you weren't getting any logging in
/var/log/daemon.log
or/var/log/syslog
before, you might have some now.The most relevant reference for job file syntax will be available when you run the command:
on your system. For Ubuntu 10.04, as you found in the previous answer, the pid file syntax is incorrect.
Any time you get that 'unknown job" error back, its a good idea to check the logs (pre 11.04, /var/log/daemon.log, 11.04 and greater everything goes in /var/log/syslog)
You may see an error like this:
Anyway I'am here because i had the same problem, but my syntax was 100% correct.
After some debugging I discovered another issue that can cause this "Unknown job" error:
upstarts uses inotify to monitor .conf file changes and auto install jobs, this is very cool (for this you don't need something like update.rc with upstart!) but can be not perfect if you (like me in that case) use some FTP/SCP GUI program to upload and edit configurations on remote servers, the job can be silently uninstalled by upstart when you edit file in that manner.
to fix simply do that (that saved me)
it will generate inotify events to refresh all upstart confs.
I had the same problem in my Ubuntu 14.04 Docker containers. As it turns out, the Ubuntu 14.04 image (if not others) for Docker does not support Upstart in the same way that a full virtual machine would.
To answer this question, why the service does not start, it is because initctl is not an actual Upstart program: it is mapped to /bin/true.
To verify run the following on a Ubuntu 14.04 Docker container vs. Vagrant, and vs. a DigitalOcean droplet
You'll see initctl is not the same in Docker vs. the others.
A link that may further your understanding.. https://github.com/docker/docker/issues/1024