【问题标题】:Upstart: Job failed to start新贵:作业无法启动
【发布时间】:2015-07-13 04:18:44
【问题描述】:

编辑

status marybaked 产量

marybaked 停止/等待

这是/var/log/syslog 的输出:

5 月 3 日 16:24:39 marybakedpdx 内核:[3464.189563] init:无法生成 marybakedpdx 主进程:找不到 setuid 用户

5 月 3 日 16:24:44 marybakedpdx 内核:[3469.342062] init:无法生成 marybaked 主进程:无法找到 setuid 用户


当我运行start marybaked 时,我得到:

启动:作业启动失败

当我运行start <anything else> 时,我得到:

开始:未知工作:

我的/var/logs/upstart 目录中没有marybaked.log 日志...这是怎么回事? upstart 怎么能认出marybaked 是一个job,启动失败,却没有为它创建错误日志?

这是我的/etc/init/marybaked.conf 文件:

# upstart service file at /etc/init/marybakedpdx.conf
    description "Meteor.js (NodeJS) application"
    author "Daniel Speichert <daniel@speichert.pro>"

    # When to start the service
    start on started mongodb and runlevel [2345]

    # When to stop the service
    stop on shutdown

    # Automatically restart process if crashed
    respawn
    respawn limit 10 5

    # we don't use buil-in log because we use a script below
    # console log

    # drop root proviliges and switch to mymetorapp user
    setuid marybakedpdx
    setgid marybakedpdx

    script
        export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        export NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
        # set to home directory of the user Meteor will be running as
        export PWD=/home/marybakedpdx
        export HOME=/home/marybakedpdx
        # leave as 127.0.0.1 for security
        export BIND_IP=127.0.0.1
        # the port nginx is proxying requests to
        export PORT=8080
        # this allows Meteor to figure out correct IP address of visitors
        export HTTP_FORWARDED_COUNT=1
        # MongoDB connection string using marybakedpdx as database name
        export MONGO_URL=mongodb://localhost:27017/marybakedpdx
        # The domain name as configured previously as server_name in nginx
        export ROOT_URL=http://marybakedpdx.com
        # optional JSON config - the contents of file specified by passing "--settings" parameter to meteor command in development mode
        export METEOR_SETTINGS='{ "somesetting": "someval", "public": { "othersetting": "anothervalue" } }'
        # this is optional: http://docs.meteor.com/#email
        # commented out will default to no email being sent
        # you must register with MailGun to have a username and password there
        # export MAIL_URL=smtp://postmaster@mymetorapp.net:password123@smtp.mailgun.org
        # alternatively install "apt-get install default-mta" and uncomment:
        # export MAIL_URL=smtp://localhost
        exec node /home/marybakedpdx/bundle/main.js >> /home/marybakedpdx/marybakedpdx.log
    end script

【问题讨论】:

    标签: ubuntu meteor nginx upstart


    【解决方案1】:

    您的新贵文件看起来不错,最有可能发生的是您的 script 块中的某些内容失败了。应该在syslog中详细说明。

    尝试查看/var/log/syslog

    为了进一步调试,您还应该在各个点尝试touch 文件,以进一步缩小问题范围。例如:

    touch /tmp/marybake0
    exec node /home/marybakedpdx/bundle/main.js >> /home/marybakedpdx/marybakedpdx.log
    

    如果文件不存在,touch 将创建该文件。

    编辑:

    从您更新的帖子来看,用户marybakedpdx 不存在。尝试运行以下命令:

    adduser marybakedpdx
    addgroup marybakedpdx
    

    【讨论】:

    • 运行ls -l /home/marybakedpdx/marybakedpdx.log。文件是否存在?如果有,所有者是谁?当你这样做时会发生什么sudo -u marybakedpdx touch /home/marybakedpdx/marybakedpdx.log
    • 我不得不跑chown marybakedpdx:marybakedpdx /home/marybakedpdx -R
    • 我无法 scp'ing 到我的服务器上。应用程序跳到 81% 然后停止,我得到 rite failed: Broken pipe lost connection
    • s您应该为此创建一个包含所有相关信息的单独问题,并将其作为新问题发布。
    • 我在 syslog 中遇到了这个问题:-“[1808381.569995] 初始化:无法生成 myProject 主进程:无法执行:权限被拒绝”
    猜你喜欢
    • 2018-11-23
    • 1970-01-01
    • 1970-01-01
    • 2012-11-11
    • 2012-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多