0

My os is mint 17.2

First off, when I start it with:

sudo /etc/init.d/lsyncd start

it starts.

But when I reboot my system it isn't started by default. How do I have it start at boot time?

I had previously had it as an Upstart job, but that wasnt working at startup either.

Here are my files/settings:

/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
        }
}

empty files /var/log/lsyncd/lsyncd.log /var/log/lsyncd/lsyncd-status.log

  • The answer to your question depends from information that you haven't supplied: what operating system this is, and what version of that operating system. Edit your question and put that in, otherwise answerers won't know whether your system can handle upstart jobs, systemd units, Debian flavours of System 5 rc scripts, Fedora flavours, BSD rc scripts, or several other possibilities; and what commands you need to use. – JdeBP Oct 22 '15 at 22:03
  • My os is mint 17.2 – Blake King Oct 23 '15 at 7:15
0

As it turned out, it was not starting because one of the rules involved an HD that was not mounted at started. Mounting then restarting lsyncd did the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.