我是新贵,需要通过它开始一个过程。但是我收到如下所述的错误。
我的脚本内容
description "Server"
author "Neeraj"
expect fork
respawn
respawn limit 5 10
console log
pre-start script
echo "`/bin/date -u`: start myappname"
end script
script
env LD_LIBRARY_PATH=/var/packages/myapp/target/bin
export LD_LIBRARY_PATH
exec /var/packages/myapp/target/bin/myappname --local-path=/var/lib/myapp
end script
post-stop script
echo "`/bin/date -u`: stop myappname"
end script
执行脚本后出错
bash-4.3# cat /var/log/upstart/pkg-myappname.log
2016-12-07T15:15:11+0800 Wed Dec 7 07:15:11 UTC 2016: start myappname
2016-12-07T15:15:11+0800 TERM=vt102
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
PWD=/
SHLVL=1
UPSTART_INSTANCE=
UPSTART_JOB=pkg-myappname
_=/bin/env
LD_LIBRARY_PATH=/var/packages/myapp/target/bin
LD_LIBRARY_PATH
2016-12-07T15:15:11+0800 /var/packages/myapp/target/bin/myappname: error while loading shared libraries: libhttp.so: cannot open shared object file: No such file or directory
bash-4.3# vi /etc/init/pkg-myappname.conf
bash-4.3# cat /var/log/upstart/pkg-myappname.log
2016-12-07T15:15:11+0800 Wed Dec 7 07:15:11 UTC 2016: start myappname
2016-12-07T15:15:11+0800 TERM=vt102
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
PWD=/
SHLVL=1
UPSTART_INSTANCE=
UPSTART_JOB=pkg-myappname
_=/bin/env
LD_LIBRARY_PATH=/var/packages/myapp/target/bin
LD_LIBRARY_PATH
2016-12-07T15:15:11+0800 /var/packages/myapp/target/bin/myappname: error while loading shared libraries: libhttp.so: cannot open shared object file: No such file or directory
问题是我的可执行文件依赖于我已将 LD_LIBRARY_PATH 设置为正确位置的一些共享库。但是一旦执行调用发生,它就看不到 LD_LIBRARY_PATH 位置并报告错误。
知道我在这里做错了什么吗?
回答我自己的问题。我不确定它是否是编写新贵脚本的解决方法或正确方法。但这就是我解决问题的方法。它现在能够正确定位共享库。
下面是工作脚本。