Skip to content

Instantly share code, notes, and snippets.

View kvaps's full-sized avatar
🔳
This mess is mine!

Andrei Kvapil kvaps

🔳
This mess is mine!
View GitHub Profile
@kvaps
kvaps / time_restore.sh
Last active October 1, 2016 16:57
OpenNebula time restore hook, it tryes to restore time after vm back from SUSPEND state during 1 minute
#!/bin/bash
#
# VM_HOOK = [
# name = "time_restore",
# on = "RUNNING",
# state = "ACTIVE",
# lcm_state = "BOOT_SUSPENDED",
# command = "time_restore.sh",
# arguments = "$ID $TEMPLATE" ]
--- /usr/share/kolab-webadmin/lib/kolab_client_task.php.bak 2016-10-17 18:30:42.341922652 +0300
+++ /usr/share/kolab-webadmin/lib/kolab_client_task.php 2016-10-17 18:30:17.975488877 +0300
@@ -260,6 +260,16 @@
die;
}
else {
+// Log fail attemts for Fail2ban ##############
+ $logfile = "/var/log/kolab-webadmin/auth_fail.log";
+ if($logfh = fopen($logfile, 'a')) {
+ $date = date("[d/M/Y:H:i:s O]");
#!/bin/bash
REPEAT=120 #2 minutes
# Wait for file
until [ -f "$1" ]; do
sleep 1
# Timeout check
if [ "$REPEAT" -gt 0 ]; then
#!/bin/bash
UUID=$1
KEYRING=$2
cat > /tmp/secret.xml <<EOT
<secret ephemeral='no' private='no'>
<uuid>$UUID</uuid>
<usage type='ceph'>
<name>client.libvirt secret</name>
#!/bin/bash
# Wait for file
until [ -f "$1" ]; do sleep 5 ; done
# Remove exist hostname
sed -i '/ '$(hostname)'$/d' "$1" 2> /dev/null
# Write new hostname
echo "$(ip addr list | grep -oP '(?<=inet )([0-9]+.){3}[0-9]+' | tail -n1) $(hostname)" >> "$1"
#!/bin/bash
CONTAINERS=($(docker ps | awk '{if(NR>1) print $NF}' | grep '_kolab_' ))
ACMESH_URL="https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh"
for i in ${CONTAINERS[@]}; do
echo
echo processing $i container:
#!/bin/bash
#
# Usage:
# swap_to_bridge.sh [bridge_name]
#
set -x
#mount -o remount,exec /tmp
R=/tmp/root
INTERFACE="$(ip route | grep -v '^default' | grep -oP -m1 '(?<=dev )[^ ]*')"
@kvaps
kvaps / beegfs-rebuild.sh
Last active March 14, 2017 23:23
Script for build beegfs-client module for specified kernel
#!/bin/bash
LAST_KERNEL="$(ls -1h /lib/modules | tail -n1)"
KERNEL="${1:-$LAST_KERNEL}"
function finish {
mv /opt/beegfs/src/client/beegfs_client_module_6/build/Makefile{.bak,}
mv /etc/beegfs/beegfs-client-autobuild.conf{.bak,}
}
trap finish EXIT

Proxmox 4.4

sed -i.bak "s/data.status !== 'Active'/false/g" \
   /usr/share/pve-manager/js/pvemanagerlib.js \
   /usr/share/pve-manager/touch/pvemanager-mobile.js

Watcher

systemctl stop corosync
systemctl stop pve-cluster
pmxcfs -l
rm /etc/pve/corosync.conf
rm /etc/corosync/authkey
rm /etc/corosync/corosync.conf
#reboot the server