From 1288b4bb09b07992324100d3274c7d6e792d4013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Choch=C3=B3=C5=82?= Date: Fri, 15 Sep 2017 14:41:22 +0200 Subject: [PATCH] Some text fixes --- README.md | 7 ++++--- statesnap.sh | 13 +++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c0f11a3..37f2f30 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # Statesnap -Ever had problem with running services after server reboot? -This script snaps state of things such as: +Ever had to reboot server you don't know well and were anxoious about whether all services will startup? +This script might help by snaping state of things such as: - List of unique processes names - List of opened TCP/UDP ports along with proces name - Firewall rules dump - Routing table +- Mount points -After restart, you can use the script to create diff's with latest snaps made, making it easy to find out what isn't working. +After restart, you can use the script to view color diff's of latest snaps made, making it easy to find out what isn't working or missing. diff --git a/statesnap.sh b/statesnap.sh index 455e5b7..9e38c7e 100755 --- a/statesnap.sh +++ b/statesnap.sh @@ -55,8 +55,15 @@ function compare { echo -e "$GREEN\nRouting table diff$RST"; HL; routingTable | diff - $FOLDER/routing.out | colorDiff } +function nonRootExit { + if [[ $EUID -ne 0 ]]; then + msg "This command must be run as root" + exit 1 + fi +} + function printHelp { - echo -e "State Snap 0.2b"; HL + echo -e "State Snap 0.3"; HL echo -e "Use: $0 [PARAMETRS]...\n" printf " $GREEN%-6s$RST %s\n" "snap" "- Make server status snapshot" printf " $GREEN%-6s$RST %s\n\n" "diff" "- Make a diff comparison against latest snapshot" @@ -71,13 +78,15 @@ fi # główny kod case $1 in diff) + nonRootExit compare ;; snap) + nonRootExit makeSnap ;; *) - msg "Nieprawidłowa komenda. Uruchom \"$0 help\" celem wyświetlenia pomocy" + msg "Unrecognised command. Run \"$0 help\" to view help." ;; esac