Explorar el Código

Adding iptables_save, getPHPHandler.sh and an inital readme

Sebastian Vendt hace 2 años
commit
6c1f889b89
Se han modificado 3 ficheros con 35 adiciones y 0 borrados
  1. 3 0
      firewall/iptables_save
  2. 26 0
      pleskDomain/getPHPHandler.sh
  3. 6 0
      readme.md

+ 3 - 0
firewall/iptables_save

@@ -0,0 +1,3 @@
+#!/bin/bash
+iptables-save | perl -ne 'print if !/f2b/' > /etc/iptables/rules.v4
+ip6tables-save | perl -ne 'print if !/f2b/' > /etc/iptables/rules.v6

+ 26 - 0
pleskDomain/getPHPHandler.sh

@@ -0,0 +1,26 @@
+#!/bin/bash
+
+if [ -z "$1" ]; then
+	echo "Error: Please provide domain name as argument."
+	echo ""
+	echo "Usage $0 [Domain-Name]"
+	exit 22;
+fi
+
+#Query the plesk database
+dboutput=$(plesk db "select d.name,h.php_handler_id,s.login from domains d join hosting h on h.dom_id=d.id join sys_users s on s.id=h.sys_user_id")
+
+#Search for the corresponding enty
+row=$(echo "$dboutput" | grep "$1")
+
+if [ $? -ne 0 ]; then
+	echo "Domain '$1' not found. Please enter a valid domain name."
+	exit 2;
+fi
+
+php_handler_id=$(echo "$row" | awk -F'|' '{print $3}')
+
+phpVersion=$(echo $php_handler_id | grep -o '[0-9]\+')
+phpVersion=${phpVersion:0:1}.${phpVersion:1}
+
+echo $phpVersion

+ 6 - 0
readme.md

@@ -0,0 +1,6 @@
+# Bash-tools repository
+This repository contains multiple small scripts or executables to ease your life with the shell. 
+Each tool is located in a separate subfolder with a separate readme. 
+
+## install
+To install the tools, just clone the repository.