upstart 服务给出‘chdir:未找到命令’错误

upstart 服务给出‘chdir:未找到命令’错误

我已经创建了一个名为 watch_folder.conf 的 upstart conf 脚本,我已经在几个 ubuntu 安装中成功使用了它,但是由于某种原因,我收到了以下代码的错误:

#/etc/init/watch_folder.conf

description "watch folder service"
author      "Jonathan Topf"

start on startup

stop on shutdown

respawn
respawn limit 99 5


script
        chdir /home/jon/Dropbox/Render\ Farm\ 1/appleseed/bin
        exec /usr/bin/python ./watchfolder.py  ../../data/
        echo "watch_folder started"
end script

如果我查看 /var/log/upstart/watch_folder.log,我会看到以下内容

/proc/self/fd/9: line 2: chdir: command not found
/proc/self/fd/9: line 2: chdir: command not found
/proc/self/fd/9: line 2: chdir: command not found
/proc/self/fd/9: line 2: chdir: command not found
/proc/self/fd/9: line 2: chdir: command not found
/proc/self/fd/9: line 2: chdir: command not found
...

有人知道什么可能导致这个错误吗?这让我很困惑!

答案1

chdir是其自己的节。将其从脚本块内部移到外部。它应该如下所示:

description "watch folder service"
author      "Jonathan Topf"

start on startup
stop on shutdown

respawn
respawn limit 99 5

chdir /home/jon/Dropbox/Render\ Farm\ 1/appleseed/bin

script
        exec /usr/bin/python ./watchfolder.py  ../../data/
        echo "watch_folder started"
end script

相关内容