Format shell scripts

Fix flags order
This commit is contained in:
jo 2021-08-16 13:45:32 +02:00
parent 6c2e547808
commit 8b3e09d41c
24 changed files with 1487 additions and 1499 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash
# Absolute path to this script
SCRIPT=`readlink -f $0`
SCRIPT=$(readlink -f $0)
# Absolute directory this script is in
SCRIPTPATH=`dirname $SCRIPT`
SCRIPTPATH=$(dirname $SCRIPT)
php -q $SCRIPTPATH/airtime-log.php "$@" || exit 1

View file

@ -24,9 +24,9 @@
# This script send data to data collection server
#
# Absolute path to this script
SCRIPT=`readlink -f $0`
SCRIPT=$(readlink -f $0)
# Absolute directory this script is in
SCRIPTPATH=`dirname $SCRIPT`
SCRIPTPATH=$(dirname $SCRIPT)
cd $SCRIPTPATH

View file

@ -24,9 +24,9 @@
# This script send data to data collection server
#
# Absolute path to this script
SCRIPT=`readlink -f $0`
SCRIPT=$(readlink -f $0)
# Absolute directory this script is in
SCRIPTPATH=`dirname $SCRIPT`
SCRIPTPATH=$(dirname $SCRIPT)
cd $SCRIPTPATH

View file

@ -1,21 +1,19 @@
#!/bin/bash
if [ -z "$1" ]
then
## Use config
backup_folder=~/libretime_backup/
else
## User arg as config
backup_folder=$1
if [ -z "$1" ]; then
## Use config
backup_folder=~/libretime_backup/
else
## User arg as config
backup_folder=$1
fi
airtime_conf_path=/etc/airtime/airtime.conf
uploads_folder=/srv/airtime/stor/
psdl_db=$(grep dbname ${airtime_conf_path} | awk '{print $3;}' )
psql_user=$(grep dbuser ${airtime_conf_path} | awk '{print $3;}' )
psql_password=$(grep dbpass ${airtime_conf_path} | awk '{print $3;}' )
psdl_db=$(grep dbname ${airtime_conf_path} | awk '{print $3;}')
psql_user=$(grep dbuser ${airtime_conf_path} | awk '{print $3;}')
psql_password=$(grep dbpass ${airtime_conf_path} | awk '{print $3;}')
## Remove old backup
rm -rf $backup_folder

View file

@ -4,11 +4,11 @@
pid_found="$?"
if [ "$pid_found" == "0" ]; then
#PID is available in the status message
rabbitmqpid=`/etc/init.d/rabbitmq-server status | grep "\[{pid" | sed "s/.*,\(.*\)\}.*/\1/"`
#PID is available in the status message
rabbitmqpid=$(/etc/init.d/rabbitmq-server status | grep "\[{pid" | sed "s/.*,\(.*\)\}.*/\1/")
else
#PID should be available from file
rabbitmqpid=`sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids`
#PID should be available from file
rabbitmqpid=$(sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids)
fi
echo "RabbitMQ PID: $rabbitmqpid"

View file

@ -7,10 +7,9 @@
# 1 - Rivendell store files in .wav format, airtime uses .mp3 format
# 2 - WAV does not have Meta-tag support so all meta-tags need to be fetched from Rivendell database.
if [ $# -ne 2 ]; then
echo "usage: $0 <rivendell_dir> <final_dir>"
exit
echo "usage: $0 <rivendell_dir> <final_dir>"
exit
fi
#*** MySql data ***#
@ -24,23 +23,21 @@ end_dir=$2
cd "$rivendell_dir"
for file in *
do
lame "$file"
for file in *; do
lame "$file"
done
mv "$rivendell_dir"/*.mp3 "$end_dir"
cd "$end_dir"
for file in *
do
id=`echo $file | head -c 10`
title=`mysql -u $user -p$pass -sN -e "SELECT CU.DESCRIPTION FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db`
artist=`mysql -u $user -p$pass -sN -e "SELECT CA.ARTIST FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db`
album=`mysql -u $user -p$pass -sN -e "SELECT CA.ALBUM FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db`
year=`mysql -u $user -p$pass -sN -e "SELECT CA.YEAR FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db`
id3 -t "$title" -a "$artist" -A "$album" -y "$year" $file
mv "$file" "$artist-$title.mp3"
for file in *; do
id=$(echo $file | head -c 10)
title=$(mysql -u $user -p$pass -sN -e "SELECT CU.DESCRIPTION FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db)
artist=$(mysql -u $user -p$pass -sN -e "SELECT CA.ARTIST FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db)
album=$(mysql -u $user -p$pass -sN -e "SELECT CA.ALBUM FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db)
year=$(mysql -u $user -p$pass -sN -e "SELECT CA.YEAR FROM CUTS CU, CART CA WHERE CA.NUMBER=CU.CART_NUMBER AND CU.CUT_NAME=\"${id}\"" $db)
id3 -t "$title" -a "$artist" -A "$album" -y "$year" $file
mv "$file" "$artist-$title.mp3"
done
exit