Startup
lsyncd 不會在啟動時啟動
我的作業系統是薄荷 17.2
首先,當我開始時:
sudo /etc/init.d/lsyncd start
開始。
但是當我重新啟動系統時,預設情況下它不會啟動。我如何讓它在啟動時啟動?
我以前曾將其作為新貴的工作,但那也不是在啟動時工作的。
這是我的文件/設置:
/etc/init.d/lsyncd
#! /bin/sh ### BEGIN INIT INFO # Provides: lsyncd # Required-Start: $remote_fs # Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: lsyncd daemon init script # Description: This script launches the lsyncd daemon. ### END INIT INFO # Author: Ignace Mouzannar <ignace@enovance.com> PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="synchronization daemon" NAME=lsyncd DAEMON=/usr/bin/$NAME CONFIG=/etc/lsyncd/lsyncd.conf.lua PIDFILE=/var/run/$NAME.pid DAEMON_ARGS="-pidfile ${PIDFILE} ${CONFIG}" SCRIPTNAME=/etc/init.d/$NAME NICELEVEL=10 # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Exit if config file does not exist [ -r "$CONFIG" ] || exit 0 # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions # # Function that starts the daemon/service # do_start() { start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ --test > /dev/null \ || return 1 start-stop-daemon --start --quiet --pidfile $PIDFILE \ --nicelevel $NICELEVEL --exec $DAEMON -- \ $DAEMON_ARGS \ || return 2 } # # Function that stops the daemon/service # do_stop() { start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 start-stop-daemon --stop --quiet --oknodo --exec $DAEMON [ "$?" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE return "$RETVAL" } # # Function that sends a SIGHUP to the daemon/service # do_reload() { start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME return 0 } case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; status) status_of_proc $DAEMON $NAME && exit 0 || exit $? ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac :
/etc/lsyncd/lsyncd.conf.lua
settings { nodaemon = false, statusFile = "/tmp/lsyncd.stat", statusInterval = 1, logfile = "/var/log/lsyncd/lsyncd.log", statusFile = "/var/log/lsyncd/lsyncd-status.log" } sync { default.rsync, source = "/home/user/bin_pers/data", target = "/home/user/test", delay=0, rsync = { perms = true, owner = true, archive = true } }
空文件 /var/log/lsyncd/lsyncd.log /var/log/lsyncd/lsyncd-status.log
事實證明,它沒有啟動,因為其中一條規則涉及在啟動時未安裝的 HD。安裝然後重新啟動 lsyncd 就可以了。