【问题标题】:How to boot Tryton server automattically如何自动启动 Triton 服务器
【发布时间】:2023-03-08 17:11:01
【问题描述】:

(我已经搜索并没有找到我要找的东西)

最近我按照 wikibooks 教程使用 Ubuntu 14.04.3 安装了 GNU Health。一切都按预期工作。但是每次启动/重新启动 ubuntu 时,我都必须手动启动 Tryton 服务器。 (如https://en.wikibooks.org/wiki/GNU_Health/Installation#Booting_up_the_Tryton_Server 中给出的)。 我想知道是否有任何方法可以让它在系统启动时自动启动。在一个站点中找到了一个脚本,但该脚本似乎已过时并且无法正常工作。是否有任何应用程序或脚本可以自动启动服务器?这样我就可以在没有任何屏幕/键盘/鼠标的情况下将机器用作服务器?

【问题讨论】:

    标签: python server sh tryton


    【解决方案1】:

    这不是特定的 tryton 问题,而是更多的 ubuntu 问题。您需要设置初始化脚本并将其安装到 System-V 脚本中。

    把这个脚本放到 /etc/init.d/tryton-server 文件,用你的 trytond 路径替换 DEAMON 变量,检查其他变量。然后运行 ​​update-rc.d tryton-server defaults 命令。

      #!/bin/sh
      ### BEGIN INIT INFO
      # Provides:             tryton-server
      # Required-Start:       $syslog $remote_fs
      # Required-Stop:        $syslog $remote_fs
      # Should-Start:         $network postgresql mysql
      # Should-Stop:          $network postgresql mysql
      # Default-Start:        2 3 4 5
      # Default-Stop:         0 1 6
      # Short-Description:    Application Platform
      # Description:          Tryton is an Application Platform serving as a base for
      #                       a complete ERP software.
      ### END INIT INFO
      PATH="/sbin:/bin:/usr/sbin:/usr/bin"
      DAEMON="[REPLACE WITH YOUR trytond PATH]"
      test -x "${DAEMON}" || exit 0
      NAME="trytond"
      DESC="Tryton Application Platform"
      DAEMONUSER="tryton"
      PIDDIR="/var/run/${NAME}"
      PIDFILE="${PIDDIR}/${NAME}.pid"
      LOGFILE="/var/log/tryton/${NAME}.log"
      DEFAULTS="/etc/default/tryton-server"
      CONFIGFILE="/etc/${NAME}.conf"
      DAEMON_OPTS="--config=${CONFIGFILE} --logfile=${LOGFILE}"
      # Include tryton-server defaults if available
      if [ -r "${DEFAULTS}" ]
      then
        . "${DEFAULTS}"
      . /lib/lsb/init-functions
      # Make sure trytond is started with configured locale
      if [ -n "${LANG}" ]
      then
        LANG="${LANG}"
        export LANG
      set -e
      do_start ()
        if [ ! -d "${PIDDIR}" ]
        then
          mkdir -p "${PIDDIR}"
          chown "${DAEMONUSER}":"${DAEMONUSER}" "${PIDDIR}"
        start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
          --chuid ${DAEMONUSER} --background --make-pidfile \
          --exec ${DAEMON} -- ${DAEMON_OPTS}
      do_stop ()
        start-stop-daemon --stop --quiet --pidfile ${PIDFILE} --oknodo
      case "${1}" in
        start)
          log_daemon_msg "Starting ${DESC}" "${NAME}"
          do_start
          log_end_msg ${?}
          ;;
        stop)
          log_daemon_msg "Stopping ${DESC}" "${NAME}"
          do_stop
          log_end_msg ${?}
          ;;
        restart|force-reload)
          log_daemon_msg "Restarting ${DESC}" "${NAME}"
          do_stop
          sleep 1
          do_start
          log_end_msg ${?}
        status)
          status_of_proc -p ${PIDFILE} ${DAEMON} ${NAME} && \
          exit 0 || exit ${?}
          N="/etc/init.d/${NAME}"
          echo "Usage: ${N} {start|stop|restart|force-reload|status}" >&2
          exit 1
          ;;
      esac
      exit 0
    

    【讨论】:

      猜你喜欢
      • 2023-02-21
      • 2017-12-29
      • 2022-12-01
      • 2016-05-24
      • 1970-01-01
      • 2013-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多