未找到Ubuntu Xenial新贵服务

时间:2017-03-24 11:07:53

标签: linux ubuntu ubuntu-14.04 ubuntu-16.04 upstart

我有一个新兴的服务,只需将我的conf存储在/etc/init/test.conf,就可以信赖。现在我已升级到Xenial 16.04.2 LTS,我遇到了无法找到服务的问题。

现在需要系统脚本吗?如果您仍然只有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.

1 个答案:

答案 0 :(得分:2)

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

  

Ubuntu 15.10或Debian Jessie的用户可能已经熟悉systemd,它现在是大多数主流GNU / Linux发行版的默认初始化系统。在Ubuntu上,systemd取代了Canonical的Upstart。

     

如果您使用自定义初始化脚本,或者定期配置长时间运行的服务,则需要了解systemd的基础知识。有关概述,请阅读Systemd Essentials: Working with Services, Units, and the Journal

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