How to execute a script on 2. last Workday of month only?

A few days i had to answer this question.

How to execute a script on 2. last Workday of month only?

With workdays, regular business days was meant.

So, i will explain the way to solve this requirement.
For some statistic jobs it may neccessary to start a script a business day eayrlier than last day of a month.
The first answer is how to get out if today is the last day of month.

  • We want to keep it simple
  • Find a general rule

„How to execute a script on 2. last Workday of month only?“ weiterlesen

Bash / Shell Basics

Working with Strings in bash.

How to extract the hostname from a FQDN String

For example: host1.example.com


#!/bin/bash
FQDN=host1.example.com

# Use cut and . as delimiter. 
HOST=$(echo $FQDN | cut -d '.' -f 1);
HOST=`echo $FQDN | cut -d '.' -f 1`
DOMAIN=$(echo $FQDN | cut -d '.' -f 2-)

# Alternative: bash include shell functions
HOST=${FQDN%%.*}
DOMAIN=${FQDN##/.*}
echo "Hostname: ${HOST}, Domain: ${DOMAIN} of FQDN: $FQDN"

Extract Filename and Path.


#!/bin/bash
FILE="/home/user/document.xml"
FILENAME=${FILE##*/}
PATH=${FILE%/*}
TYPE=${FILE##*.}

echo "File Name: ${FILENAME} in path: ${PATH} of type ${TYPE}";

Oracle Invalide Objekte finden und compilieren.

Bei diversen Änderungen von Tabellendefinitionen, Funktionen etc. werden teilweise abhängige Objekte weitere Funktionen, Views usw. invalidiert.
Die Frage ist dann immer:  Wie überwacht man dieses und wie automatisiert man es, dass die Objekte wieder valide werden?

Ein simples Stück Code löst dieses Problem.

„Oracle Invalide Objekte finden und compilieren.“ weiterlesen