When working with Ubuntu 10.04 (Lucid Lynx) which uses Upstart 0.6.5, you might encounter the "unknown job" error when trying to manage services. This typically occurs when the Upstart job file isn't properly placed in the correct directory or contains syntax errors.
For Upstart to recognize your nginx service, the job file must be placed in /etc/init/
with a .conf
extension:
sudo nano /etc/init/nginx.conf
Here's a working configuration for nginx on Ubuntu 10.04:
description "nginx http daemon"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/usr/sbin/nginx
env PID=/var/run/nginx.pid
expect fork
respawn
respawn limit 10 5
pre-start script
$DAEMON -t
if [ $? -ne 0 ]
then exit $?
fi
end script
exec $DAEMON -c /etc/nginx/nginx.conf
The working configuration includes several improvements:
- Proper dependency declaration with filesystem and networking
- Environment variables for maintainability
- Pre-start validation
- Simplified runlevel handling
After creating the configuration file, verify and start the service:
sudo initctl check-config nginx
sudo start nginx
sudo status nginx
If you still encounter problems:
- Check file permissions:
sudo chmod 644 /etc/init/nginx.conf
- Verify nginx binary path with:
which nginx
- Examine logs:
tail -f /var/log/upstart/nginx.log
For better process management, consider using start-stop-daemon
in your Upstart script:
exec start-stop-daemon --start --quiet --pidfile $PID --exec $DAEMON -- -c /etc/nginx/nginx.conf
When trying to start Nginx using Upstart on Ubuntu 10.04 (Lucid Lynx), you might encounter the frustrating "unknown job" error. This typically indicates that Upstart can't find your job definition file in the correct location.
For Upstart to recognize your Nginx job, the configuration file must be placed in /etc/init/
with a .conf
extension. The correct path would be:
/etc/init/nginx.conf
Here's a working Upstart configuration for Nginx on Ubuntu 10.04:
description "nginx http daemon"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/usr/sbin/nginx
env PID=/var/run/nginx.pid
expect fork
respawn
respawn limit 10 5
pre-start script
$DAEMON -t
if [ $? -ne 0 ]; then
exit $?
fi
end script
exec $DAEMON
After placing the file, you can verify it's recognized by Upstart with:
initctl list | grep nginx
1. File permissions: Ensure the file is readable:
sudo chmod 644 /etc/init/nginx.conf
2. Syntax errors: Validate your configuration:
init-checkconf /etc/init/nginx.conf
3. Path issues: Verify Nginx binary location matches your env DAEMON
setting.
If you're still having issues, you can create a traditional init script in /etc/init.d/
and symlink it to the appropriate runlevels:
sudo update-rc.d nginx defaults
For deeper troubleshooting, examine Upstart logs:
sudo tail -f /var/log/upstart/nginx.log
Or check the system log:
sudo tail -f /var/log/syslog