|
@@ -7298,6 +7298,93 @@ Save and exit.
|
7298
|
7298
|
chmod +x /etc/cron.hourly/repair
|
7299
|
7299
|
#+END_SRC
|
7300
|
7300
|
|
|
7301
|
+Also to keep maintenance to the minimum we need to automatically repair the databases when the system initially boots after a power cycle. So if there's an electrical power outage and the session table gets corrupted then you don't need to be concerned with repairing it manually.
|
|
7302
|
+
|
|
7303
|
+#+BEGIN_SRC: bash
|
|
7304
|
+editor /usr/bin/runinitialrepair
|
|
7305
|
+#+END_SRC
|
|
7306
|
+
|
|
7307
|
+Add the following:
|
|
7308
|
+
|
|
7309
|
+#+BEGIN_SRC: bash
|
|
7310
|
+#!/bin/bash
|
|
7311
|
+sleep 180
|
|
7312
|
+/etc/cron.hourly/repair > /var/log/initialrepair.log
|
|
7313
|
+exit 0
|
|
7314
|
+#+END_SRC
|
|
7315
|
+
|
|
7316
|
+Save and exit.
|
|
7317
|
+
|
|
7318
|
+#+BEGIN_SRC: bash
|
|
7319
|
+chmod +x /usr/bin/runinitialrepair
|
|
7320
|
+editor /etc/init.d/initialrepair
|
|
7321
|
+#+END_SRC
|
|
7322
|
+
|
|
7323
|
+Add the following:
|
|
7324
|
+
|
|
7325
|
+#+BEGIN_SRC: bash
|
|
7326
|
+#!/bin/bash
|
|
7327
|
+
|
|
7328
|
+# /etc/init.d/initialrepair
|
|
7329
|
+
|
|
7330
|
+### BEGIN INIT INFO
|
|
7331
|
+# Provides: initialrepair
|
|
7332
|
+# Required-Start: $remote_fs $syslog
|
|
7333
|
+# Required-Stop: $remote_fs $syslog
|
|
7334
|
+# Default-Start: 2 3 4 5
|
|
7335
|
+# Default-Stop: 0 1 6
|
|
7336
|
+# Short-Description: mysql database repair on boot
|
|
7337
|
+# Description: Repairs mysql databases at startup
|
|
7338
|
+### END INIT INFO
|
|
7339
|
+
|
|
7340
|
+# Author: Bob Mottram <bob@robotics.uk.to>
|
|
7341
|
+
|
|
7342
|
+#Settings
|
|
7343
|
+SERVICE='initialrepair'
|
|
7344
|
+INVOCATION='/usr/bin/runinitialrepair'
|
|
7345
|
+PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin'
|
|
7346
|
+
|
|
7347
|
+initialrepair_start() {
|
|
7348
|
+echo "Starting $SERVICE..."
|
|
7349
|
+su --command "screen -h 1024 -dmS ${SERVICE} ${INVOCATION}" root
|
|
7350
|
+}
|
|
7351
|
+
|
|
7352
|
+
|
|
7353
|
+initialrepair_stop() {
|
|
7354
|
+echo "Stopping $SERVICE"
|
|
7355
|
+su --command "screen -p 0 -S ${SERVICE} -X stuff "'^C'"" root
|
|
7356
|
+}
|
|
7357
|
+
|
|
7358
|
+
|
|
7359
|
+#Start-Stop here
|
|
7360
|
+case "$1" in
|
|
7361
|
+ start)
|
|
7362
|
+ initialrepair_start
|
|
7363
|
+ ;;
|
|
7364
|
+ stop)
|
|
7365
|
+ initialrepair_stop
|
|
7366
|
+ ;;
|
|
7367
|
+ restart)
|
|
7368
|
+ initialrepair_stop
|
|
7369
|
+ initialrepair_start
|
|
7370
|
+ ;;
|
|
7371
|
+ *)
|
|
7372
|
+ echo "Usage: $0 {start|stop|restart}"
|
|
7373
|
+ exit 1
|
|
7374
|
+ ;;
|
|
7375
|
+esac
|
|
7376
|
+
|
|
7377
|
+exit 0
|
|
7378
|
+#+END_SRC
|
|
7379
|
+
|
|
7380
|
+Save and exit.
|
|
7381
|
+
|
|
7382
|
+#+BEGIN_SRC: bash
|
|
7383
|
+chmod +x /etc/init.d/initialrepair
|
|
7384
|
+update-rc.d initialrepair defaults
|
|
7385
|
+service initialrepair start
|
|
7386
|
+#+END_SRC
|
|
7387
|
+
|
7301
|
7388
|
** Install Tripwire
|
7302
|
7389
|
|
7303
|
7390
|
#+BEGIN_VERSE
|