Commit 0e402e1b authored by Michael Völske's avatar Michael Völske
parents 5e3332ca 6c43fff5
......@@ -21,6 +21,8 @@ For usage help run:
./webis.py -h
```
Or look at the [cheatsheet](cheatsheet.txt)
### Install
If you are on a webis machine, `webis` should already be installed. If not, contact our administrators.
......@@ -112,6 +114,9 @@ Add a description of the command in the `"commands_help"` section of the
`config.json` configuration file. You can also add shortcut aliases in
`"commands_aliases"`.
To update the cheatsheet.md, run `webis core update-cheatsheet` and then commit
the changes together with the new command.
#### Code conventions for command scripts
Inside a command directory, every script should have a small
descriptive comment, e.g.:
......
WEBIS CHEATSHEET
================
betamng Low level scripts for managing Betaweb.
activate_vnc_all Activate vnc on all nodes of the hostlist
bios_cpu_test_all Starts bios cpu test on all nodes of the hostlist
change_lcd_msg_all Change lcd message of every node of betaweb to betaweb???
check_dimms Check for warnings concerning RAM modules in idrac for all betaweb machines
do_all Run a command sequential on all betamng nodes
enable_pxe_bios_boot_all Enable pxe bios boot on all hosts: experimental! hope and prey
get_bios_boot_settings_all Get boot settings from all nodes
pssh Run a command parallel on all betamng nodes
read_all_macs Printout system dump of all hosts for extracting mac addresses
set_critical_temp_shutdown Set settings for shutdown on critical temperature
ssh Open ssh session to one of the betamng nodes (racadm can be used)
start_all Start every node of betamng (parallel)
status_all Get power status of every node of betamng
stop_all Shutdown every node of betamng
virtualscreen Open java vnc session to one of the betamng nodes, via idrac
vnc Open vnc session to one of the betamng nodes
betaweb High level scripts for betaweb, e.g. hadoop management.
check_ram
restart_hadoop_ressourcemanager Restart hadoop ressource manager on betaweb020 and restarts nodemanager
rolling_restart Restart betaweb nodes one after another
rolling_state Apply Salt state on nodes one after another
status Get status of betaweb via salt
core Core functions of the Webis command.
checker Check codestyle of project
install Install webis to PATH
remove Remove webis from PATH
update Update the webis command from Git
update-cheatsheet Update local copy of code-webis-cmd/cheatsheet.txt
version Get webis version
cvs Helper scripts for working with the Webis CVS server
status Checks what changed in this CVS directory without doing anything
update Update this CVS directory, deleting directories that were deleted on the server
elasticsearch Helper scripts for managing Elasticsearch on the Betaweb cluster.
restart_nodes Restart Elasticsearch cluster
start_nodes Restart Elasticsearch cluster
stop_nodes Restart Elasticsearch cluster
git Helper scripts for working with the Webis Git server and GitLab instance.
clone-deps Clone dependencies for current project from GitLab
clone-groups Check out groups of webis gitlab projects at once
cvs2git Import all CVS modules into new Git repositories and push
cvstree2git Try to clone all projects in the current CVS tree from Git.
gitlab Gitlab commandline interface that comes with python-gitlab
init Initialize GitLab API client
onboard Set up the correct Gitlab group permissions for a new student or Hiwi
update-project Clone or update the given Git project from GitLab.
web-admin Display a web-admin view for Gitlab (need to have a token with admin access)
util General helper tools and utilities
backup-btrfs-vol Take a snapshot of a btrfs subvolume and back up its contents to another location
login Get user name for a university login
patch-jar Add files from one jar to another
read-from-clipboard Print the clipboard to standard output
sshproxy Set up an SSH proxy tunnel for accessing digital library content or university-restricted URLs
tasks Execute lists of tasks in parallel
write-to-clipboard Fill the clipboard from standard input
webis20 Storage Management Scripts, need direct access to RAID Controller and MegaCLI installed
lsi
Generated using *webis core update-cheatsheet*. If you find this file to be outdated, rerun this command and push the updated file to the Git server.
......@@ -6,6 +6,7 @@
"version": "core/version.sh",
"commands_help": {
"core": "Core functions of the Webis command.",
"cvs": "Helper scripts for working with the Webis CVS server",
"test": "A few unimportant test scripts for developing purpose.",
"util": "General helper tools and utilities",
"betamng": "Low level scripts for managing Betaweb.",
......
......@@ -24,7 +24,7 @@ logError() {
# Printout info message.
#
logInfo() {
echo -e "\033[92m[INFO ]\033[0m $@"
echo -e "\033[92m[INFO ]\033[0m $@" 1>&2;
}
#
......
No preview for this file type
......@@ -57,7 +57,7 @@ def _gitlab_api_url(path, **params):
except KeyError:
lError("Error reading config file. Have you run 'webis git init'?\n")
sys.exit(1)
url = "{}/api/v3/{}?{}".format(url, path, urlencode(params))
url = "{}/api/v4/{}?{}".format(url, path, urlencode(params))
return url
......
#!/bin/bash
# activate vnc on all nodes of the hostlist
# Activate vnc on all nodes of the hostlist
#
# Copyright 2014-today www.webis.de
#
......@@ -34,4 +34,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# starts bios cpu test on all nodes of the hostlist
# Starts bios cpu test on all nodes of the hostlist
#
# Copyright 2014-today www.webis.de
#
......@@ -32,4 +32,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# change lcd message of every node of betaweb to betaweb???
# Change lcd message of every node of betaweb to betaweb???
#
# Copyright 2014-today www.webis.de
#
......@@ -33,4 +33,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# Check for warnings concerning RAM modules in idrac for all betaweb machines
#
# Copyright 2018-today www.webis.de
#
# Project WEBIS
# Author: Michael Völske
#
scriptPath=${0%/*}
. "$scriptPath"/../../libs/bashhelper.sh
check_tools "ssh" "sshpass" "awk" "xargs"
BETAWEB_FIRST=1
BETAWEB_LAST=135
usage() {
echo "
Usage:
$(basename "$0") [fist_betaweb_host last_betaweb_host]
The scanned host numbers are ${BETAWEB_FIRST} through ${BETAWEB_LAST} by default.
"
}
if [ -z ${SSHPASS+x} ]; then
read_password "Enter betamng password:" SSHPASS
else
logInfo "Using credentials from SSHPASS environment variable"
fi
# define awk script for parsing the racadm output
read -d '' PARSE_IDRAC_REPORT <<"EOF"
BEGIN {
ORS = "\\0" # null-delimited output
N_SLOTS=0
N_EMPTY=0
N_WARNINGS=0
N_OK=0
}
/^DIMM/ { N_SLOTS+=1; }
/^DIMM [AB][0-9]+ *N\\/A/ { N_EMPTY+=1 }
/^DIMM [AB][0-9]+ *Ok/ { N_OK+=1 }
/^DIMM [AB][0-9]+ *Warning/ {
WARNINGS[N_WARNINGS] = $2
N_WARNINGS+=1
}
END {
if (N_SLOTS < 1) {
print "; NO DATA"
exit 0
}
d = N_SLOTS - N_EMPTY
v = "; " N_SLOTS " slots; " d " installed"
v = v "; " N_OK " OK"
if (N_WARNINGS > 0) {
v = v "; " N_WARNINGS " warning(s):"
for (p in WARNINGS) {
v = v " " WARNINGS[p]
}
}
print v
}
EOF
main() {
FIRST=${1:-${BETAWEB_FIRST}}
LAST=${2:-${BETAWEB_LAST}}
export SSHPASS
export PARSE_IDRAC_REPORT
seq $FIRST $LAST \
| xargs printf "betamng%03d " \
| xargs -n1 -P0 \
bash -c 'sshpass -e \
ssh -q \
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o ConnectTimeout=10 \
webis@$1 racadm getsensorinfo \
| awk "${PARSE_IDRAC_REPORT}" | xargs -0 printf "$1%s\n" ' _
}
main "$@"
#!/bin/bash
# run a command sequential on all betamng nodes
# Run a command sequential on all betamng nodes
#
# Copyright 2014-today www.webis.de
#
......@@ -56,4 +56,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# enable pxe bios boot on all hosts: experimental! hope and prey
# Enable pxe bios boot on all hosts: experimental! hope and prey
#
# Copyright 2014-today www.webis.de
#
......@@ -49,4 +49,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# get boot settings from all nodes
# Get boot settings from all nodes
#
# Copyright 2014-today www.webis.de
#
......@@ -31,4 +31,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# run a command parallel on all betamng nodes
# Run a command parallel on all betamng nodes
#
# Copyright 2014-today www.webis.de
#
......@@ -39,4 +39,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# printout system dump of all hosts for extracting mac addresses
# Printout system dump of all hosts for extracting mac addresses
#
# Copyright 2014-today www.webis.de
#
......@@ -37,4 +37,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# set settings for shutdown on critical temperature
# Set settings for shutdown on critical temperature
#
# Copyright 2015-today www.webis.de
#
......
#!/bin/bash
# open ssh session to one of the betamng nodes (racadm can be used)
# Open ssh session to one of the betamng nodes (racadm can be used)
#
# Copyright 2014-today www.webis.de
#
......@@ -38,4 +38,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# start every node of betamng (parallel)
# Start every node of betamng (parallel)
#
# Copyright 2014-today www.webis.de
#
......@@ -34,4 +34,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# get power status of every node of betamng
# Get power status of every node of betamng
#
# Copyright 2014-today www.webis.de
#
......@@ -32,4 +32,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# shutdown every node of betamng
# Shutdown every node of betamng
#
# Copyright 2014-today www.webis.de
#
......@@ -27,11 +27,11 @@ Usage:
# hard shutdown via:
# > racadm serveraction powerdown
main() {
yes_no_prompt "Are you shure to stop all nodes of betamng?" "n" &&
yes_no_prompt "Are you sure to stop all nodes of betamng?" "n" &&
"$scriptPath/pssh.sh" "racadm serveraction graceshutdown"
}
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# open java vnc session to one of the betamng nodes, via idrac
# Open java vnc session to one of the betamng nodes, via idrac
#
# Copyright 2014-today www.webis.de
#
......@@ -27,10 +27,6 @@ Usage:
#
main() {
. "$scriptPath/config/config.sh"
if ! grep "$@" "$hostnames"; then
logError "hostname $@ is not valid."
exit 1
fi
cd "$scriptPath/virtualscreen"
./virtualscreen.py "$@"
......@@ -40,4 +36,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# open vnc session to one of the betamng nodes
# Open vnc session to one of the betamng nodes
#
# Copyright 2014-today www.webis.de
#
......@@ -38,4 +38,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# restart hadoop ressource manager on betaweb020 and restarts nodemanager
# Restart hadoop ressource manager on betaweb020 and restarts nodemanager
#
# Copyright 2015-today
#
......@@ -37,4 +37,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# get status of betaweb via salt
# Get status of betaweb via salt
#
# Copyright 2015-today
#
......@@ -34,4 +34,4 @@ main() {
#
# Start programm with parameters.
#
main "$@"
\ No newline at end of file
main "$@"
#!/bin/bash
# check codestyle of project
# Check codestyle of project
#
# Codestyle checker
#
......
#!/usr/bin/env python3
# easter egg
"""
Easter egg
Copyright 2015-today
Project WEBIS
Author: Steve Göring
"""
import os
import sys
import inspect
import time
import shutil
script_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
sys.path.insert(0, os.path.abspath(os.path.join(script_dir, "..", "..", "libs")))
from log import *
def main(params):
max_i = shutil.get_terminal_size().columns
for j in range(3):
for i in range(0, max_i):
if i % 2 == 0:
print(" " * i + colorred("ᗧ") + "•" * (max_i - i - 1), end='\r')
else:
print(" " * i + colorgreen("◯") + "•" * (max_i - i - 1), end='\r')
time.sleep(0.15)
for i in reversed(range(0, max_i)):
if i % 2 == 0:
print("•" * i + colorred("ᗤ") + " " * (max_i - i - 1), end='\r')
else:
print("•" * i + colorgreen("◯") + " " * (max_i - i - 1), end='\r')
time.sleep(0.15)
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
#!/bin/bash
# install webis to PATH
# Install webis to PATH
#
# Copyright 2015-today
#
......
#!/bin/bash
# remove webis from PATH
# Remove webis from PATH
#
# Copyright 2015-today
#
......
#!/bin/bash
# Update local copy of code-webis-cmd/cheatsheet.txt
#
# Update Webis command
#
# Copyright 2017-today
#
# Project WEBIS
# Author: Johannes Kiesel
#
# Constants
#
cheatsheetname=cheatsheet.txt
#
# Load libaries and toolkits.
#
scriptPath=${0%/*}
. ${scriptPath}/../../libs/bashhelper.sh
. ${scriptPath}/../../libs/shflags
check_tools "git"
#
# Define usage screen.
#
usage() {
echo "
Usage:
$(basename "$0")
Description:
Update local copy of code-webis-cmd/${cheatsheetname}
Examples:
$(basename "$0")
"
exit 1
}
#
# Define command line arguments and parse them.
#
FLAGS_HELP=$(usage)
export FLAGS_HELP
FLAGS "$@" || exit 1 # Parse command line arguments.
eval set -- "${FLAGS_ARGV}"
#
#
#
generate_cheatsheet() {
echo "WEBIS CHEATSHEET
================
"
./webis.py --helptable
echo "
Generated using *webis core update-cheatsheet*. If you find this file to be outdated, rerun this command and push the updated file to the Git server."
}
#
#
#
main() {
webiscmdrootpath="$(${scriptPath}/../../libs/readlink-f.py $scriptPath/../../)/"
logInfo "${scriptPath}"
cd "$webiscmdrootpath"
logInfo "Writing to ${webiscmdrootpath}/${cheatsheetname}"
generate_cheatsheet > ${cheatsheetname}
}
#
# Start programm with parameters.
#
main "$@"
#!/bin/bash
# update the webis command from Git
# Update the webis command from Git
#
# Update Webis command
#
......
#!/bin/bash
# get webis version
# Get webis version
#
# Copyright 2015-today
#
......
#!/bin/bash
# Checks what changed in this CVS directory without doing anything
#
# Copyright 2018-today
#
# Project WEBIS
# Author: Johannes Kiesel
scriptPath=${0%/*}
. "$scriptPath"/../../libs/bashhelper.sh
. "$scriptPath"/../../libs/shflags
check_tools "cvs"
#
# Define usage screen.
#
usage() {
echo "usage:
$(basename "$0")
description:
checks what changed in this CVS directory without doing anything
"
}
#
# Define command line arguments and parse them.
#
FLAGS_HELP=$(usage)
export FLAGS_HELP
FLAGS "$@" || exit 1 # Parse command line arguments.
eval set -- "${FLAGS_ARGV}"
RED='\033[0;31m'
BLUE='\033[0;34m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
get_status() {
local tmp=/tmp/cvsstat-$$
cvs status > $tmp
cat $tmp | grep "^File: " | grep -v "Up-to-date" \
| awk '{
file = $2
status = $5
if (status == "Modified") {
status = "Needs commit"
color = "'$GREEN'"
} else if (status == "Patch") {
status = "Needs update"
color = "'$BLUE'"
} else if (status == "Merge") {
status = "Needs merge"
color = "'$RED'"
}
printf "%s%-20s\033[0m %s\n", color, status, file
}'
cat $tmp | grep "^\\?" \
| awk '{
file = $2
color = "'$GREEN'"
status = "Needs commit (new)"
printf "%s%-20s\033[0m %s\n", color, status, file
}'
rm $tmp
}
#
# Main
#
main() {
echo "CVS STATUS"
get_status | sort
}
#
# Start programm with parameters.
#
main "$@"
#!/bin/bash
# Update this CVS directory, deleting directories that were deleted on the server
#
# Copyright 2018-today
#
# Project WEBIS
# Author: Johannes Kiesel
scriptPath=${0%/*}
. "$scriptPath"/../../libs/bashhelper.sh
. "$scriptPath"/../../libs/shflags
check_tools "cvs"
#