coren has submitted this change and it was merged.
Change subject: Add script "toolwatcher".
......................................................................
Add script "toolwatcher".
(Updated to current version)
Change-Id: I4d7462baf8ca03c5cdcf31feaca2ba60226828a7
---
A usr/local/sbin/toolwatcher
1 file changed, 36 insertions(+), 0 deletions(-)
Approvals:
coren: Verified; Looks good to me, approved
diff --git a/usr/local/sbin/toolwatcher b/usr/local/sbin/toolwatcher
new file mode 100755
index 0000000..12ad3f1
--- /dev/null
+++ b/usr/local/sbin/toolwatcher
@@ -0,0 +1,36 @@
+#! /bin/bash
+
+export HOME=/root
+while true;do
+ cd /data/project/
+ for tool in $(getent passwd | cut -d : -f 1 | sed -n
'/^local-/{s///;p}'); do
+ if [ ! -d "/data/project/$tool" ]; then
+ logger -t toolwatcher "Creating tool $tool"
+
+ mkdir "$tool"
+ mkdir "$tool/public_html"
+ mkdir "$tool/cgi-bin"
+ chmod -R g+rw,o+r "$tool"
+ chown -R "local-$tool:local-$tool" "$tool"
+ find "$tool" -type d | xargs chmod g+sx,o+x
+ fi
+
+ if [ -r $tool/replica.my.cnf -a ! -r
/data/project/.system/cache/localdb-$tool ]; then
+ user="$(sed -n -e "/user='\(.*\)'/{;s//\1/;p;}" $tool/replica.my.cnf)"
+ password="$(sed -n -e "/password='\(.*\)'/{;s//\1/;p;}"
$tool/replica.my.cnf)"
+ /usr/bin/mysql -h tools-db -u root <<-END
+ grant usage on *.* to '$user'@'%' identified by '$password';
+ grant all privileges on \`${user}__%\`.* to '$user'@'%';
+END
+ touch /data/project/.system/cache/localdb-$tool
+ fi
+
+ if ! grep -q "^$tool " /data/project/.system/webservers
>/dev/null; then
+ echo "add '$tool' to webservers again?"
+ echo "$tool tools-webserver-01"
>>/data/project/.system/webservers
+ fi
+ done
+ cd /tmp
+ sleep 120
+done
+
--
To view, visit https://gerrit.wikimedia.org/r/62348
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4d7462baf8ca03c5cdcf31feaca2ba60226828a7
Gerrit-PatchSet: 3
Gerrit-Project: labs/toollabs
Gerrit-Branch: master
Gerrit-Owner: Petrb <[email protected]>
Gerrit-Reviewer: Tim Landscheidt <[email protected]>
Gerrit-Reviewer: coren <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits