[英]Why this shell won't work if it's called from rc.local but SSH?
我做了这个shell脚本
/var/start-app.sh
#!/bin/sh
# file-name: app-start.sh
cd /var/www/html/app
bundle exec rake sunspot:solr:start RAILS_ENV=production
unicorn_rails -c config/unicorn.rb -E production -D
如果我在SSH中键入/var/start-app.sh
。 它触发,一切正常。
然后,我确实将sh /var/start-app.sh
放在/etc/rc.d/rc.local
末行,以使其在Server的启动中运行。
但这是行不通的。 为什么? 以及如何启用呢?
从SSH,我以root
权限调用它。 那是为什么 如果是这样,如何授予rc.local
root权限?
似乎从rc.local启动服务不是最佳实践http://bencane.com/2011/12/30/when-its-ok-and-not-ok-to-use-rc-local/ 。 您最好编写一个初始化脚本: http : //refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/sysinit.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.