我已经安装了Virtuoso,我想创建一个服务,所以这个服务可以从操作系统开始。要正常启动Virtuoso,请转到cd /usr/local/var/lib/virtuoso/db
目录并运行virtuoso-t -f
。这个命令必须在我提到的目录中执行,否则它不会读取配置文件。所以我在/etc/init.d/virtuoso
创建了脚本。
#!/bin/bash
# Virtuoso Startup script for the Openlink Virtuoso
# Source function library.
. /etc/rc.d/init.d/functions
prog="virtuoso"
lockfile=/var/lock/subsys/virtuoso.lock
RETVAL=0
start() {
echo -n $"Starting $prog: "
cd /usr/local/var/lib/virtuoso/db/ | virtuoso-t -f
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -TERM
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
# status -p $pidfile && exit 0 || exit $?
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|status}"
RETVAL=2
esac
exit $RETVAL
但该服务抱怨它没有找到命令virtuoso-t
。如果我创建一个脚本以便在没有service start virtuoso
的情况下手动启动它就可以了。但如果我调用/etc/init.d/virtuoso
内的脚本不起作用。
有任何线索吗?感谢
# service virtuoso status
● virtuoso.service - SYSV: The Openlink Virtuoso is a high-performance object-relational SQL database.
Loaded: loaded (/etc/rc.d/init.d/virtuoso; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2017-03-09 11:17:25 EST; 28s ago
Docs: man:systemd-sysv-generator(8)
Process: 10905 ExecStart=/etc/rc.d/init.d/virtuoso start (code=exited, status=127)
Mar 09 11:17:25 irodsprodvm.ebioscience.amc.nl systemd[1]: Starting SYSV: The Openlink Virtuoso is a high-performance object-relational SQL database....
Mar 09 11:17:25 irodsprodvm.ebioscience.amc.nl virtuoso[10905]: Starting virtuoso: /etc/rc.d/init.d/virtuoso: line 19: virtuoso-t: command not found
Mar 09 11:17:25 irodsprodvm.ebioscience.amc.nl systemd[1]: virtuoso.service: control process exited, code=exited status=127
Mar 09 11:17:25 irodsprodvm.ebioscience.amc.nl systemd[1]: Failed to start SYSV: The Openlink Virtuoso is a high-performance object-relational SQL database..
Mar 09 11:17:25 irodsprodvm.ebioscience.amc.nl systemd[1]: Unit virtuoso.service entered failed state.
Mar 09 11:17:25 irodsprodvm.ebioscience.amc.nl systemd[1]: virtuoso.service failed.
Warning: virtuoso.service changed on disk. Run 'systemctl daemon-reload' to reload units.
答案 0 :(得分:0)
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin