Die Formel lautet also: (Monatstag - Wochentag + 1)/7 == 2
#! /usr/bin/bash
[ 2 -eq $[$(/usr/bin/date +'(%-d-%u+1)/7')] ] || exit
exec mache "$@"You can configure an alarm to run a script or a command in the vSphere Web Client when the alarm is triggered.
Use the alarm environment variables to define complex scripts and attach them to multiple alarms or inventory objects. For example, you can write a script that enters the following trouble ticket information into an external system when an alarm is triggered:
- Alarm name
- Object on which the alarm was triggered
- Event that triggered the alarm
- Alarm trigger values
When you write the script, include the following environment variables in the script:
- VMWARE_ALARM_NAME
- VMWARE_ALARM_TARGET_NAME
- VMWARE_ALARM_EVENTDESCRIPTION
- VMWARE_ALARM_ALARMVALUE
You can attach the script to any alarm on any object without changing the script.
The script runs on the vCenter Server machine, and it runs even if you close the vSphere Web Client.
Learn Vimscript the Hard Way is a book for users of the Vim editor who want to learn how to customize Vim.
It is not a guide to using Vim. Before reading this book you should be comfortable editing text in Vim and know what terms like "buffer", "window" and "insert mode" mean.
The book is divided roughly into three sections:
- The first covers basic Vim commands that you can use in your ~/.vimrc file to customize Vim quickly and easily.
- The second looks more deeply at Vimscript as a programming language, covering things like variables, comparisons, and functions.
- The third walks through the creation of a sample plugin intended for distribution to other Vim users.
The book is copyright 2013 by Steve Losh, all rights reserved. You can redistribute this HTML version as long as you don't make any changes and don't charge for it.
The book will always be free to read online.
The goals of ShellCheck are
- To point out and clarify typical beginner's syntax issues that cause a shell to give cryptic error messages.
- To point out and clarify typical intermediate level semantic problems that cause a shell to behave strangely and counter-intuitively.
- To point out subtle caveats, corner cases and pitfalls that may cause an advanced user's otherwise working script to fail under future circumstances.
See the gallery of bad code for examples of what ShellCheck can help you identify!
First, why bother? Well, while bash is the default /bin/sh shell on many rpm-based Linux distributions (so it’s also the default shell on the systems I’m developing with and thus referring to here), it’s often not the case on other Linux distributions like Debian or Alpine, and it’s certainly not the case on non-Linux systems like the various *BSD flavors or illumos based installations.
xdotool lets you programatically (or manually) simulate keyboard input and mouse activity,
move and resize windows, etc. It does this using X11's XTEST extension and other Xlib
functions.
There is some support for Extended Window Manager Hints (aka EWMH or NetWM). See the
"EXTENDED WINDOW MANAGER HINTS" section for more information.What is xdotool?
This tool lets you simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11’s XTEST extension and other Xlib functions.
Additionally, you can search for windows and move, resize, hide, and modify window properties like the title. If your window manager supports it, you can use xdotool to switch desktops, move windows between desktops, and change the number of desktops.
!/bin/bash
#
# (c) Frank Matthieß 2020
#
#
NAME=$(basename $0)
info() { echo "$*">&2; }
error() { info "ERROR: $*"; }
APIURL=https://api.opensensemap.org/boxes
TMPFILE=$(mktemp)
STIDFILE=$(mktemp)
trap 'rm -f ${TMPFILE} ${STIDFILE} ' INT EXIT
# At the map, click on an station icon and you get, for example, this url:
# https://opensensemap.org/explore/5b4d11485dc1ec001b5452c7
#
# Add the id tring at the end of the url with a proper name to the sensor id list
# Sensor id list
cat<<EOSTIDS>$STIDFILE
5c22ef44919bf8001a10acc7 Berlin Charlottenburg
5a9c2087bc2d4100191d6ff9 Stuttgart Unteraichen (A8)
5b4d11485dc1ec001b5452c7 München Fakultät Informatik
EOSTIDS
#
#
# Adjust the field length of the output
llen=0
while read stid location; do
l=$(wc -c <<< "$location")
if [ $llen -lt $l ]; then
llen=$l
fi
done < $STIDFILE
#
# .. and get the need values via opensensemap api
#
while read stid location; do
curl -sL ${APIURL}/${stid} > ${TMPFILE}
reallocation=$(jq .name < ${TMPFILE})
temperature=$(jq '.sensors[] | select(.title|test("Temperatur")) | .title, .lastMeasurement.value, .unit' < ${TMPFILE} | xargs )
humidity=$(jq '.sensors[] | select(.title|test("rel. Luftfeuchte")) | .title, .lastMeasurement.value, .unit' < ${TMPFILE} | xargs )
rawcoordinates=$(jq '.currentLocation.coordinates[]' < ${TMPFILE} | xargs )
coordinates=$(while read lon lat heigh; do echo "https://www.openstreetmap.org/?mlat=${lat}&mlon=${lon}#map=12/${lat}/$lon"; done <<< "${rawcoordinates}")
#
printf "%-${llen}s:\n\tStationsname : %s\n\t%s\n\t%s\n\tOpenstreetmap: %s\n" \
"${location}" \
"${reallocation//\"/}" \
"${temperature}" \
"${humidity}" \
"${coordinates}"
done < $STIDFILE
# vim:set ts=8 sts=8 sw=8 ft=sh ai tw=80:Below are some simple Sieve code examples, more can be found at http://sieve.info/examplescripts
ShellCheck is...
- GPLv3: free as in freedom
- available on GitHub
- already packaged for your distro or package manager
- supported as an integrated linter in major editors
- available in CodeClimate, Codacy and CodeFactor to auto-check your GitHub repo
- written in Haskell, if you're into that sort of thing.
Publishes RSS/Atom feeds to Diaspora*
This is a lightweight, customizable "bot" script to harvest RSS/Atom feeds and re-publish them to the Diaspora social network. It is posted here without warranty, for public use.
v2 is a complete re-write of the original pod_feeder script which was written (poorly) in perl and is no longer supported. Migrating to this version is recommended.
An Ansible dynamic inventory script to process Terraform state and return Ansible host data from Terraform Provider for Ansible host resources. See the Terraform Provider for it's own installation and use.
Powershell script to check windows updates using NRPE/NSClient++
Checks:
- how many critical and optional updates are available
- whether the system is waiting for reboot after installed updates
Features: - properly handles NRPE's 1024b limitation in return packet
- hidden updates return OK state
- Performance data in return packet shows titles of available critical updates
- caches updates in file to reduce network traffic, also dramatically increases script execution speed
Return Values for NRPE:
- No updates available - OK (0)
- Hidden Updates only - OK (0)
- Updates already installed, reboot required - WARNING (1)
- Optional updates available - WARNING (1)
- Critial updates available - CRITICAL (2)
- Script errors - UNKNOWN (3)
PyInstaller freezes (packages) Python applications into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.
PyInstaller’s main advantages over similar tools are that PyInstaller works with Python 2.7 and 3.4—3.7, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility
borgmatic is a simple Python wrapper script for the Borg backup software that initiates a backup, prunes any old backups according to a retention policy, and validates backups for consistency. The script supports specifying your settings in a declarative configuration file rather than having to put them all on the command-line, and handles common errors.
atticmatic is a simple Python wrapper script for the Attic and Borg backup software that initiates a backup, prunes any old backups according to a retention policy, and validates backups for consistency. The script supports specifying your settings in a declarative configuration file rather than having to put them all on the command-line, and handles common errors.
Shell script to test the performance of the most popular DNS resolvers from your location.
Includes by default:
CloudFlare 1.1.1.1
Google 8.8.8.8
Quad9 9.9.9.9
OpenDNS
Norton
CleanBrowsing
Yandex
AdGuard
Neustar
ComodoShellCheck is a static analysis tool for shell scripts. One can use it to finds bugs in your shell scripts. It is written in Haskell. You can find warnings and suggestions for bash/sh shell scripts with this tool. Let us see how to install and use ShellCheck on a Linux or Unix-like system to enhance your shell scripts, avoid errors and productivity.