From f54a4bbe21325833c0262313384e0696ebb40cc6 Mon Sep 17 00:00:00 2001 From: following Date: Sat, 20 Jul 2013 12:21:57 +0200 Subject: [PATCH] fixed replication_monitor.sh --- local/prodsys/replication_monitor.sh | 813 ++------------------------- 1 file changed, 44 insertions(+), 769 deletions(-) diff --git a/local/prodsys/replication_monitor.sh b/local/prodsys/replication_monitor.sh index 998e3353..cf1f165b 100644 --- a/local/prodsys/replication_monitor.sh +++ b/local/prodsys/replication_monitor.sh @@ -1,769 +1,44 @@ - - - - - - - - - opencaching/code/htdocs/util2/replication_monitor/replication_monitor.sh at master ยท OpencachingTeam/opencaching - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
-
- - - - - -
- - - - - -
- - -
-
- - - - - -
- - This repository - - -
-
- -
- - -
This repository
-
- -
- - -
All repositories
-
- -
-
-
- - - - - - - - -
- -
- - - - - - - - - - - - -
-
- - - - - - - - -
- -
-
- - -
    - -
  • -
    - -
    - - - - - Watch - - - -
    -
    -
    - Notification status - -
    - -
    - -
    - -
    - -

    Not watching

    - You only receive notifications for discussions in which you participate or are @mentioned. - - - Watch - -
    -
    - -
    - -
    - -

    Watching

    - You receive notifications for all discussions in this repository. - - - Unwatch - -
    -
    - -
    - -
    - -

    Ignoring

    - You do not receive any notifications for discussions in this repository. - - - Stop ignoring - -
    -
    - -
    - -
    -
    -
    - -
    -
  • - -
  • - - - -
  • - - -
  • - - Fork - - -
  • - - -
- -

- public - - - /opencaching - - - Octocat-spinner-32 - - - - forked from totsubo/se2de-merge - -

-
-
- -
- -
- -
- - - - - - -
- - - - - -
-

HTTPS clone URL

- - - - -
- - - -
-

SSH clone URL

- - - - -
- - - -
-

Subversion checkout URL

- - - - -
- - - -

You can clone with - HTTPS, - SSH, - Subversion, - and other methods. -

- - - - - Clone in Desktop - - - - - - Download ZIP - - -
-
- -
- - - - - - - - -Show File Finder - -
- - - -
- - - branch: - master - - -
- -
-
- Switch branches/tags - -
- -
-
- -
-
- -
-
- -
- -
- - -
- - master -
-
- - ocde_updates -
-
- - ocdegpx -
- -
- - ocdetest -
-
- - ocsedev -
-
- - ocseprod -
-
- - rootpath -
-
- -
Nothing to show
-
- -
-
- - -
- -
Nothing to show
-
- -
-
-
- - -
- - - -
- - - - - - - -
- - -
-
-
-
- - file - 45 lines (40 sloc) - 1.248 kb -
- - -
-
- - - - - -
- 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 - - -
#!/bin/bash
#
# Opencaching replication monitor bash script
#
# This script writes every 10 seconds the current timestamp to
# table sys_repl_timestamp. This enables the cron-module
# repliaction_monitor to check if the mysql replication slave(s) is up to
# date and online.
#
# You should place this bash script outside the PHP configured
# open_basedir restriction and place a cronjob entry that
# executes every 5 minutes or place it in rc.3 or rc.5
# (run this script on the master database server, not on any slave!)
#
# If you setup a cronjob call it with parameter "-q" to prevent
# output of running-message.
#

# begin of configuration
PIDFILE=/var/run/oc_replication_monitor.pid
DBHOST=oc
DBNAME=oc
DBUSER=oc
DBPASSWORD=oc
# end of configuration

if [ -f $PIDFILE ]; then
if [ -d /proc/`cat $PIDFILE` ]; then
if (readlink /proc/`cat $PIDFILE`/exe | grep -q /bin/bash); then
if [ "$1" != "-q" ]; then
echo "replication_monitor running with pid `cat $PIDFILE`, exiting"
      fi
exit
fi
fi
fi

echo $$ > $PIDFILE

while [ 1 ]
do
mysql -h$DBHOST -u$DBUSER -p$DBPASSWORD $DBNAME --execute="INSERT INTO sys_repl_timestamp (id, data) VALUES (1, NOW()) ON DUPLICATE KEY UPDATE data=NOW();"
  sleep 10
done
-
-
- -
-
- - - - -
-
- -
- -
-
- - - - -
- -
- - -
-
-
- -
-
-
-
-
-
- -
- - - -
- - - Something went wrong with that request. Please try again. -
- - - - - +#!/bin/bash +# +# Opencaching replication monitor bash script +# +# This script writes every 10 seconds the current timestamp to +# table sys_repl_timestamp. This enables the cron-module +# repliaction_monitor to check if the mysql replication slave(s) is up to +# date and online. +# +# You should place this bash script outside the PHP configured +# open_basedir restriction and place a cronjob entry that +# executes every 5 minutes or place it in rc.3 or rc.5 +# (run this script on the master database server, not on any slave!) +# +# If you setup a cronjob call it with parameter "-q" to prevent +# output of running-message. +# + +# begin of configuration +PIDFILE=/var/run/oc_replication_monitor.pid +DBHOST=oc +DBNAME=oc +DBUSER=oc +DBPASSWORD=oc +# end of configuration + +if [ -f $PIDFILE ]; then +if [ -d /proc/`cat $PIDFILE` ]; then +if (readlink /proc/`cat $PIDFILE`/exe | grep -q /bin/bash); then +if [ "$1" != "-q" ]; then +echo "replication_monitor running with pid `cat $PIDFILE`, exiting" + fi +exit +fi +fi +fi + +echo $$ > $PIDFILE + +while [ 1 ] +do +mysql -h$DBHOST -u$DBUSER -p$DBPASSWORD $DBNAME --execute="INSERT INTO sys_repl_timestamp (id, data) VALUES (1, NOW()) ON DUPLICATE KEY UPDATE data=NOW();" + sleep 10 +done \ No newline at end of file