Skip to content

Commit

Permalink
2016 update, deprecated scripts removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Brooker committed Feb 13, 2016
1 parent f8389f1 commit b0f1bf0
Show file tree
Hide file tree
Showing 18 changed files with 103 additions and 434 deletions.
3 changes: 1 addition & 2 deletions README.md
@@ -1,5 +1,4 @@
Linux shell scripts collection
==============================


Author: Fred Brooker <original@fredbrooker.cz> http://fredbrooker.cz/
author: Fred Brooker https://fredbrooker.cz/
22 changes: 0 additions & 22 deletions backup-home.sh

This file was deleted.

22 changes: 0 additions & 22 deletions backup-root.sh

This file was deleted.

25 changes: 0 additions & 25 deletions backup-www.sh

This file was deleted.

13 changes: 5 additions & 8 deletions detoxify.sh
@@ -1,9 +1,5 @@
#!/bin/bash

# Author: Fred Brooker <original@fredbrooker.cz>
# URL: http://fredbrooker.cz/


if [ $# -eq 0 ]
then
echo -e "\nFix filenames recursively.\n\nSyntax: $(basename $0) <folder>\n"
Expand All @@ -13,7 +9,7 @@ else
then
if [ -d "$1" ]
then
echo "Processing folder: $1"
echo "Processing: $1"
else
echo "Invalid folder: $1"
exit 1
Expand All @@ -25,18 +21,19 @@ which detox >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo "Installing detox package..."
sudo apt-get install detox
sudo apt-get install -yqq detox
fi

which detox >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo "Detox is not installed!"
echo "ERROR: Detox is not installed!"
exit 1
fi

detox --special --remove-trailing -r -v -s utf_8 "$1"
detox --special --remove-trailing -r -v -s lower "$1"
sync

echo -e "\nDone.\n"

exit 0
20 changes: 9 additions & 11 deletions flac2mp3.sh
@@ -1,9 +1,5 @@
#!/bin/bash

# Author: Fred Brooker <original@fredbrooker.cz>
# URL: http://fredbrooker.cz/


if [ $# -eq 0 ]
then
echo -e "\nConvert FLAC files to MP3 recursively.\n\nSyntax: $(basename $0) <folder>\n"
Expand All @@ -24,24 +20,27 @@ which flac >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "Installing flac package...\n"
sudo apt-get install flac
sudo apt-get install -yqq flac
fi

which flac >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "Flac is not installed!\n"
echo -e "ERROR: flac is not installed!\n"
exit 1
fi

which lame >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "Installing lame package...\n"
sudo apt-get install lame
sudo apt-get install -yqq lame
fi

which lame >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "Lame is not installed!\n"
echo -e "ERROR: lame is not installed!\n"
exit 1
fi

Expand All @@ -65,11 +64,10 @@ do
then
echo "Converting: $i"
flac -d "$i"
lame -b 320 "${i%.flac}.wav" "${i%.flac}.mp3"
lame -h --preset extreme "${i%.flac}.wav" "${i%.flac}.mp3"
fi
done

sync

echo -e "\nDone.\n"

exit 0
10 changes: 4 additions & 6 deletions git-create.sh
@@ -1,9 +1,5 @@
#!/bin/bash

# Author: Fred Brooker <original@fredbrooker.cz>
# URL: http://fredbrooker.cz/


if [ -z "$1" ]
then
echo -e "\nCreates new git repository.\n\nSyntax: $(basename $0) <name>\n"
Expand All @@ -14,12 +10,13 @@ which git >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo "Installing git-core package..."
sudo apt-get install git-core
sudo apt-get install -yqq git-core
fi

which git >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "git is not installed!\n"
echo -e "ERROR: git is not installed!\n"
exit 1
fi

Expand All @@ -34,4 +31,5 @@ else
fi

echo -e "\nDone.\n"

exit 0
10 changes: 4 additions & 6 deletions hibernate.sh
@@ -1,24 +1,22 @@
#!/bin/bash

# Author: Fred Brooker <original@fredbrooker.cz>
# URL: http://fredbrooker.cz/


which pmi >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "Installing powermanagement-interface package...\n"
sudo apt-get install powermanagement-interface
sudo apt-get install -yqq powermanagement-interface
fi

which powermanagement-interface >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "Powermanagement-interface is not installed!\n"
echo -e "ERROR: Powermanagement-interface is not installed!\n"
exit 1
fi

sync
pmi action hibernate

echo -e "\nDone.\n"

exit 0
77 changes: 34 additions & 43 deletions pdf-check.sh
@@ -1,70 +1,61 @@
#!/bin/bash

# Author: Fred Brooker <original@fredbrooker.cz>
# URL: http://fredbrooker.cz/


if [ $# -eq 0 ]
then
echo -e "\nCheck validity of PDF files recursively.\n\nSyntax: $(basename $0) <folder>\n"
exit 1
echo -e "\nCheck validity of PDF files recursively.\n\nSyntax: $(basename $0) <folder>\n"
exit 1
fi
if [ -n "$1" ]
then
if [ -d "$1" ]
then
cd "$1"
else
echo -e "Invalid folder: $1\n"
exit 1
fi
if [ -d "$1" ]
then
cd "$1"
else
echo -e "Invalid folder: $1\n"
exit 1
fi
fi

# check for installed app
which pdfinfo >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "Installing xpdf-utils package...\n"
sudo apt-get install xpdf-utils
echo -e "Installing xpdf-utils package...\n"
sudo apt-get install -yqq xpdf-utils
fi

which pdfinfo >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "Xpdf-utils are not installed!\n"
exit 1
echo -e "ERROR: xpdf-utils are not installed!\n"
exit 1
fi

# recurse any directories first
for i in *
do
if [ -d "$i" ]
then
echo "Recursing into directory: $i"
$0 "$i"
fi
if [ -d "$i" ]
then
echo "Recursing into: $i"
$0 "$i"
fi
done

# check pdf files (or recurse .pdf directories)
for i in *.pdf
do
if [ -d "$i" ]
then
echo "Recursing into directory: $i"
$0 "$i"
fi
if [ -f "$i" ]
then
echo "Checking: $i"
/usr/bin/pdfinfo "$i" >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Invalid PDF file: $i"
mv "$i" "invalid-pdf-$i"
fi
fi
if [ -d "$i" ]
then
# echo "Recursing into: $i"
$0 "$i"
fi
if [ -f "$i" ]
then
# echo "Checking: $i"
/usr/bin/pdfinfo "$i" >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Invalid PDF file: $i !!!"
mv "$i" "$i.bad"
fi
fi
done

sync

echo -e "\nDone.\n"
exit 0
10 changes: 1 addition & 9 deletions pinglan.sh
@@ -1,9 +1,5 @@
#!/bin/bash

# Author: Fred Brooker <original@fredbrooker.cz>
# URL: http://fredbrooker.cz/


if [ -z "$3" ]
then
echo -e "\nPing network range\n\nSyntax: $(basename $0) <subnet> <low> <hi>\nExample: $(basename $0) 192.168.1 1 10\n\n"
Expand All @@ -23,10 +19,6 @@ NETWORK=$1
LO=$2
HI=$3

for i in `seq $LO $HI`
do
is_alive_ping $i
done
for i in `seq $LO $HI`; do is_alive_ping $i; done

echo -e "\nDone.\n"
exit 0

0 comments on commit b0f1bf0

Please sign in to comment.