Ubuntu 未找到 Xenial upstart 服务

Ubuntu Xenial upstart service not found

我有一个 upstart 服务,只需将我的 conf 存储在 /etc/init/test.conf 即可可靠地工作。现在我已经升级到 Xenial 16.04.2 LTS,我遇到了找不到服务的问题。

现在需要systemd脚本吗?如果您仍然可以仅使用 conf 文件就可以拥有新贵,我必须怎么做才能解决这个问题?

这里有一个示例 from digital ocean 可以说明问题:

ubuntu@vagrant:~$ sudo ls -la /etc/init/test.conf 
-rw-r--r-- 1 root root 126 Mar 24 10:54 /etc/init/test.conf
ubuntu@vagrant:~$ sudo cat /etc/init/test.conf 
description "Job that runs the foo daemon"
start on runlevel [2345]
exec echo Test Job ran at  `date` >> /var/log/testjob.log
ubuntu@vagrant:~$ sudo service test status
● test.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
ubuntu@vagrant:~$ sudo service test start
Failed to start test.service: Unit test.service not found.

Xenial Xerus 使用 systemd 而不是 upstart。来自 the release notes for Xenial:

Users of Ubuntu 15.10 or Debian Jessie may already be familiar with systemd, which is now the default init system for the majority of mainstream GNU/Linux distributions. On Ubuntu, systemd supplants Canonical's Upstart.

If you make use of custom init scripts, or routinely configure long-running services, you will need to know the basics of systemd. For an overview, read Systemd Essentials: Working with Services, Units, and the Journal.

This guide 也可能有用,从 Vivid 出来的时候开始。