小编use*_*510的帖子

systemd显然没有找到.service文件

我为我们的foo服务组装了一个foo.service文件,作为守护进程运行.当我运行systemctl start foo(和stop)但 systemtcl enable foo结果时,服务运行正常Failed to issue method call: Invalid argument.单元文件放在/etc/systemd/system/foo.service,并具有权限0755.将systemd设置为debug并运行enable give

Looking for unit files in (highest priority first):`
    /etc/systemd/system
    /run/systemd/system
    /usr/local/lib/systemd/system
    /usr/lib/systemd/system
Looking for SysV init scripts in:
    /etc/rc.d/init.d
Looking for SysV rcN.d links in:
    /etc/rd.c
Failed to issue method call: Invalid argument
Run Code Online (Sandbox Code Playgroud)

谷歌搜索似乎没有找到.service文件.有什么方法可以验证吗?如果是这样,我该如何解决?关于可能出错的其他任何想法?我可以启用更多调试吗?给出的调试信息并没有真正帮助我缩小问题的范围.

foo.service看起来像:

[Unit]
Description=Blah Blah Blah

[Service]
ExecStart=/usr/bar/doof/foo
Type=simple
PIDFile=/var/run/foo.pid

[Install]
WantedBy=multi-user.target,graphical.target
Run Code Online (Sandbox Code Playgroud)

编辑:是的,我确实跑了systemctl daemon-reload.

systemd

9
推荐指数
4
解决办法
2万
查看次数

如何在Rust中构建向量的HashMap?

我是Rust新手.我试图将有向图的邻接列表表示为char {vertex name}的HashMap到Vector of(char,int){vertex name,cost}.我希望最终的HashMap是不可变的,但我想构建向量,然后不需要复制它以使其不可变.

我的代码如下.在指定的行我得到"不能借用不可变的解引用(取消引用是隐含的,由于索引)是可变的".这是有道理的,因为地图中的Vec <(char,int)>不可变.但我不确定如何解决它.

在Rust中有办法做到这一点吗?

pub struct Edge {
    to:     char,
    from:   char,
    weight: int
}

pub struct digraph {
    _vertices:  Vec<char>,
    _adj_list:  HashMap<char, Vec<(char,int)> >
}

impl digraph {
    pub fn new(nodes: &Vec<char>, edges: &Vec<Edge> ) -> Option<digraph> {
        let mut tmp_adj_list = HashMap::new();
        for node in (*nodes).iter() {
            tmp_adj_list.insert(*node, Vec::new());
        }
        for edge in (*edges).iter() {
            let Edge{ to: to, from:from, weight:weight } = *edge;
            if  !(*nodes).contains(&to) |  !(*nodes).contains(&from) {
                return None;
            }
            tmp_adj_list[from].push((to,weight))  // …
Run Code Online (Sandbox Code Playgroud)

rust

4
推荐指数
1
解决办法
3394
查看次数

标签 统计

rust ×1

systemd ×1