Merge pull request #142 from kozross/master

Add OpenRC support, fixed daemon script
pull/163/head
Orsiris de Jong 6 years ago committed by GitHub
commit f6db6fb9e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,7 +30,7 @@ osync uses pidlocks to prevent multiple concurrent sync processes on/to the same
You may launch concurrent sync processes on the same system but as long as the replicas to synchronize are different.
Multiple osync tasks may be launched sequentially by osync osync-batch tool.
Currently, it has been tested on CentOS 5.x, 6.x, 7.x, Fedora 22-25, Debian 6-8, Linux Mint 14-18, Ubuntu 12.04-12.10, FreeBSD 8.3-11, Mac OS X and pfSense 2.3x.
Currently, it has been tested on CentOS 5.x, 6.x, 7.x, Fedora 22-25, Debian 6-8, Linux Mint 14-18, Ubuntu 12.04-12.10, FreeBSD 8.3-11, Gentoo, Mac OS X and pfSense 2.3x.
Microsoft Windows is supported via MSYS or Cygwin and now via Windows 10 bash.
Android support works via busybox (tested on Termux).
@ -148,7 +148,7 @@ Having multiple conf files can then be run in a single cron command like
Daemon mode
-----------
Additionnaly, you may run osync in monitor mode, which means it will perform a sync upon file operations on initiator replica.
Additionaly, you may run osync in monitor mode, which means it will perform a sync upon file operations on initiator replica.
This can be a drawback on functionnality versus scheduled mode because this mode only launches a sync task if there are file modifications on the initiator replica, without being able to monitor the target replica.
Target replica changes are only synced when initiator replica changes occur, or when a given amount of time (default 600 seconds) passed without any changes on initiator replica.
File monitor mode can also be launched as a daemon with an init script. Please read the documentation for more info.
@ -168,6 +168,8 @@ Systemd specific (one service per config file)
$ systemctl start osync-srv@configfile.conf
$ systemctl enable osync-srv@configfile.conf
OpenRC-specific instructions can be found in ``osync-srv-openrc``.
Security enhancements
---------------------
Remote SSH connection security can be improved by limiting what hostnames may connect, disabling some SSH options and using ssh filter.

@ -0,0 +1,55 @@
#!/sbin/openrc-run
#
# PROGRAM="osync-srv"
# AUTHOR="(C) Brian Evans 2018"
# CONTACT="grknight@gentoo.org"
# PROGRAM_BUILD=20180517
#
# How to use:
#
# 0) Rename this to osync-srv, and place it in /etc/init.d.
# 1) Ensure that your config is located in /etc/osync, under some name with a
# .conf extension.
# 2) Ensure that osync.sh can be found in /usr/local/bin.
# 3) Ensure that you have rsync and inotify-tools installed.
# 4) Symlink this to a name with an extension equal to the basename of your
# config file.
# 5) Add to the default runlevel under the symlinked name.
#
# Example:
#
# Suppose the config is located at /etc/osync/documents.conf. You then want to
# symlink as follows:
#
# # ln -s /etc/init.d/osync-srv /etc/init.d/osync-srv.documents
#
# Then you can start the service as normal:
#
# # rc-update add osync-srv.documents default
depend() {
use localmount chrony ntp-client
}
description="Two way directory sync daemon"
command=/usr/local/bin/osync.sh
conffile="${RC_SVCNAME#*.}.conf"
cfgfile="/etc/osync/${conffile}"
command_args="${cfgfile} --on-changes --errors-only"
command_background="yes"
pidfile="/var/run/${RC_SVCNAME}"
stopsig=TERM
start_pre() {
if [ "${conffile}" = ".conf" ]; then
eerror "${RC_SVCNAME} cannot be started directly. You must create"
eerror "symbolic links to it for the configuration you want to start"
eerror "osync on and add those to the appropriate runlevels."
return 1
fi
if ! [ -f "${cfgfile}" ]; then
eerror "Cannot find configuration file ${cfgfile}."
return 1
fi
}
Loading…
Cancel
Save