无论我在该行中设置什么值,DAEMON=/home/odoo/odoo/odoo-bin
它始终会在 ExecStart 中运行旧进程。换句话说,我的更改未应用。我运行sudo nano /etc/init.d/odoo
然后sudo service odoo start
它永远不会应用我的更改。
#!/bin/bash
### BEGIN INIT INFO
# Provides: odoo
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start odoo daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
## more info: http://wiki.debian.org/LSBInitScripts
. /lib/lsb/init-functions
PATH=/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin
WORKDIR=/home/odoo/
DAEMON=/home/odoo/odoo/odoo-bin
NAME=odoo
DESC=odoo
CONFIG=/home/odoo/odoo.conf
LOGFILE=/var/log/odoo/odoo.log
PIDFILE=/var/run/${NAME}.pid
USER=odoo
export LOGNAME=$USER
test -x $DAEMON || exit 0
set -e
function _start() {
start-stop-daemon --chdir=${WORKDIR} --start --quiet --pidfile $PIDFILE --chuid $USER:$USER --background --make-pidfile --exec $DAEMON -- --config $CONFIG --logfile $LOGFILE
}
function _stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --retry 3
rm -f $PIDFILE
}
function _status() {
start-stop-daemon --status --quiet --pidfile $PIDFILE
return $?
}
case "$1" in
start)
echo -n "Starting $DESC: "
_start
echo "ok"
;;
stop)
echo -n "Stopping $DESC: "
_stop
echo "ok"
;;
restart|force-reload)
echo -n "Restarting $DESC: "
_stop
sleep 1
_start
echo "ok"
;;
status)
echo -n "Status of $DESC: "
_status && echo "running" || echo "stopped"
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
我尝试改变
DAEMON=/home/odoo/odoo/odoo-bin
到
DAEMON=/home/odoo/odoo/odoo-binFAKEPATH
然后运行:
sudo service odoo start
sudo service odoo status
但我仍然得到:
● odoo.service - odoo
Loaded: loaded (/etc/systemd/system/odoo.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-04-11 21:45:20 CDT; 2s ago
Process: 4467 **ExecStart=/home/odoo/odoo/server/odoo-bin** --config /home/odoo/odoo.conf (code=exited, status=203/EXEC)
Main PID: 4467 (code=exited, status=203/EXEC)
我期望看到的是:
ExecStart=/home/odoo/odoo/odoo-binFAKEPATH
答案1
更改该文件没有任何效果。我编辑了错误的文件。我还必须更新
sudo nano /etc/systemd/system/odoo.service
因为我的系统systemd
不使用init.d