Added two additional scripts as example (see also <https://lug-vs.org/lugvswiki/index.php?title=Nuetzliche_Scripte>)
This commit is contained in:
parent
ad2dab0754
commit
07c91a937e
3 changed files with 72 additions and 2 deletions
|
@ -7,6 +7,6 @@ My personally used scripts
|
|||
|Script|Description|
|
||||
|---|---|
|
||||
|[duc-index.sh](duc-index.sh)|Script to be added e.g. as cronjob, which generate an index w/o nfs and dfs filesystem mounted files|
|
||||
|
||||
|
||||
|[diskfree.sh](diskfree.sh)|Script shows the free memory of all mounted filesystems beside *tmpfs|
|
||||
|[jpg-add-comment.sh](jpg-add-comment.sh)|Add a comment in all *.jpg files in the actuall and all subfolders|
|
||||
|
||||
|
|
38
diskfree.sh
Executable file
38
diskfree.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# df with some options and colored if Alert levels are exceeded
|
||||
# (c) GPL by Ulf Bartolomäus
|
||||
VERSION="Version 0.1.1 from 13.02.2021"
|
||||
|
||||
# 0.1.1
|
||||
# Initial based on whatch_new
|
||||
|
||||
MyDfC='df -hTx tmpfs -x devtmpfs' ## df - command - w/o *tenpfs
|
||||
MyDfCnN='df -hTx tmpfs -x devtmpfs -x fuse -x nfs4' ## df - command - w/o *tenpfs, fusa and nfs4
|
||||
#MyDfC="${MyDfCnN}" ## zweite verusion statt erste
|
||||
MyDfAlert1=80 ## alert level of df
|
||||
MyDfAlert2=90 ## critical alert level of df
|
||||
|
||||
## Escape secences for color
|
||||
esc=$(echo -en "\033") ## define esc secence
|
||||
dick="${esc}[1m" ## define bold secence
|
||||
rot="${esc}[1;31m" ## define red secence
|
||||
gruen="${esc}[1;32m" ## define green secence
|
||||
gelb="${esc}[1;33m" ## define yelow secence
|
||||
blau="${esc}[1;34m" ## define blue secence
|
||||
lila="${esc}[1;35m" ## define purple secence
|
||||
norm=$(echo -en "${esc}[m\017") ## define default secence
|
||||
|
||||
## DiskFree (only if not the same device => uniq check first 40 characters
|
||||
${MyDfC} | uniq -w40 | while read MyOutput; do ## Execute df and filter doublicates - for each row stored in MyOutput
|
||||
MyDfUsage=$(echo ${MyOutput} | awk '{ print $6}' | cut -d'%' -f1 ) ## Search Usage in %
|
||||
if [[ ! $( echo "${MyDfUsage}" | grep [[:digit:]] ) ]] ; then ## If first row
|
||||
echo -e ${dick}"${MyOutput}"${norm} ## Echo in bold
|
||||
elif [ $(( ${MyDfUsage} )) -ge ${MyDfAlert2} ]; then ## If critical level excided
|
||||
echo -e ${rot}"${MyOutput}"${norm} ## Echo in red
|
||||
elif [ $(( ${MyDfUsage} )) -ge ${MyDfAlert1} ]; then ## If alert level excided
|
||||
echo -e ${gelb}"${MyOutput}"${norm} ## Echo in yelow
|
||||
else ## default
|
||||
echo -e ${gruen}"${MyOutput}"${norm} ## Echo in green
|
||||
fi
|
||||
done
|
32
jpg-add-comment.sh
Normal file
32
jpg-add-comment.sh
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
# Add a exif-comment to all JPEG-Files from this directory and all subdirectorys
|
||||
#
|
||||
# (c) LUG-VS (GPL)
|
||||
VERSION="make_exif-name.sh Version 0.0.2 from 23.10.2005"
|
||||
#
|
||||
# Input: comment text
|
||||
# Output: changed files
|
||||
#
|
||||
# Changes:
|
||||
# 0.0.2: comment as parameter from commandline
|
||||
# 0.0.1: generation
|
||||
#
|
||||
|
||||
COMMENTSTEXT=$*
|
||||
JPEGFILEFILTER=*.jpg
|
||||
|
||||
# trap is executed if script breaks
|
||||
trap "echo '*** TRAP ***' ; exit" ERR
|
||||
|
||||
# check if command exists else break
|
||||
which exiftran > /dev/null || echo "exiftran not found!" || exit;
|
||||
|
||||
echo "Write Comment: <"${COMMENTSTEXT}">"
|
||||
# for each file in JPEGFILEFILTER do
|
||||
# exiftran - transform digital camera jpeg images and use the libexif-Library
|
||||
# -i Enable inplace editing of the images.
|
||||
# -b Create a backup file when doing inplace editing.
|
||||
# -p Preserve timestamps (atime + mtime) when doing inplace editing.
|
||||
# -c <text> Set jpeg comment tag to <text>.
|
||||
find . -type f -name "${JPEGFILEFILTER}" -exec exiftran -ibp -c "${COMMENTSTEXT}" {} \;
|
||||
|
Loading…
Reference in a new issue