Last active
March 23, 2019 15:19
-
-
Save ajdavis/dc03c14f4059ca8f8217d4f282c937de to your computer and use it in GitHub Desktop.
"mirror" configuration, see https://github.com/stephenh/mirror/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>local.mirror-client</string> | |
<key>Program</key> | |
<string>/usr/bin/java</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/bin/java</string> | |
<string>-Xmx2G</string> | |
<string>-cp</string> | |
<string>/Users/emptysquare/bin/mirror-all.jar</string> | |
<string>mirror.Mirror</string> | |
<string>client</string> | |
<string>--exclude</string> | |
<string>co/mongo/.vscode/</string> | |
<string>--exclude</string> | |
<string>co/mongo/build/*</string> | |
<string>--exclude</string> | |
<string>co/mongo/build.ninja</string> | |
<string>-l</string> | |
<string>co</string> | |
<string>-h</string> | |
<string>10.1.2.58</string> | |
<string>-r</string> | |
<string>co</string> | |
</array> | |
<key>WorkingDirectory</key> | |
<string>/mirror/</string> | |
<key>StandardOutPath</key> | |
<string>/Users/emptysquare/mirror.log</string> | |
<key>StandardErrorPath</key> | |
<string>/Users/emptysquare/mirror.log</string> | |
<key>LaunchOnlyOnce</key> | |
<true/> | |
</dict> | |
</plist> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# "mirror" configuration, see https://github.com/stephenh/mirror/issues/19 | |
# put this in /etc/init.d/mirror-server | |
### BEGIN INIT INFO | |
# Required-Start: $local_fs $remote_fs $network $java | |
# Required-Stop: $local_fs $remote_fs $network $java | |
# Provides: mirror-server | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: File tree sync mirror server | |
# Description: File tree sync mirror server | |
### END INIT INFO | |
NAME="mirror-server" | |
DESC="File tree mirror service" | |
SCRIPTNAME="/etc/init.d/$NAME" | |
SHUTDOWN_HELPER="pkill java" | |
LOGFILE="/var/log/mirror.log" | |
CONFFILE="/etc/mirror/mirror-server.conf" | |
# Load the variables | |
. "$CONFFILE" | |
OPTIONS="" | |
if [ "$SKIP_LIMIT_CHECKS" = "TRUE" ] ; then | |
OPTIONS="--skip-limit-checks" | |
fi | |
if [ "$MIRROR_DIR" = "" ] ; then | |
echo "Must define MIRROR_DIR in $CONFFILE" | |
exit 1 | |
fi | |
case "$1" in | |
start) | |
cd "$MIRROR_DIR" | |
touch "$LOGFILE" | |
chown emptysquare: "$LOGFILE" | |
/bin/su emptysquare /usr/local/bin/mirror server 2>&1 >> /var/log/mirror.log & | |
echo "mirror service started in $MIRROR_DIR" | |
;; | |
stop) | |
pkill java >null 2>&1 | |
pkill mirror >null 2>&1 | |
# this is obviously overkill and may kill needed processes | |
# but I don't see a graceful shutdown option available yet | |
# there is definitely room for improvement here | |
;; | |
status) | |
if ps -Al| grep mirror|grep -v "mirror-server" >null 2>null ; then | |
echo "mirror server running" | |
else | |
echo "mirror server not running" | |
fi | |
;; | |
*) | |
echo "Usage: $SCRIPTNAME {start|stop|status}" >&2 | |
exit 3 | |
;; | |
esac | |
: | |
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# put this in /etc/mirror/mirror-server.conf | |
# uncomment this line to enable it | |
# other variables can go here, but must also be accounted for in the script | |
#SKIP_LIMIT_CHECKS=TRUE | |
MIRROR_DIR=/mirror |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment