parent
6c2e547808
commit
8b3e09d41c
|
@ -14,8 +14,8 @@ rabbitmqctl list_vhosts | grep $RABBITMQ_VHOST
|
||||||
RESULT="$?"
|
RESULT="$?"
|
||||||
|
|
||||||
if [ $RESULT = "0" ]; then
|
if [ $RESULT = "0" ]; then
|
||||||
rabbitmqctl delete_vhost $RABBITMQ_VHOST
|
rabbitmqctl delete_vhost $RABBITMQ_VHOST
|
||||||
rabbitmqctl delete_user $RABBITMQ_USER
|
rabbitmqctl delete_user $RABBITMQ_USER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rabbitmqctl add_vhost $RABBITMQ_VHOST
|
rabbitmqctl add_vhost $RABBITMQ_VHOST
|
||||||
|
@ -29,9 +29,8 @@ export RABBITMQ_VHOST
|
||||||
export AIRTIME_UNIT_TEST="1"
|
export AIRTIME_UNIT_TEST="1"
|
||||||
|
|
||||||
#Change the working directory to this script's directory
|
#Change the working directory to this script's directory
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
cd $DIR
|
cd $DIR
|
||||||
|
|
||||||
#Run the unit tests
|
#Run the unit tests
|
||||||
phpunit --verbose --log-junit test_results.xml
|
phpunit --verbose --log-junit test_results.xml
|
||||||
|
|
||||||
|
|
34
build.sh
34
build.sh
|
@ -3,25 +3,25 @@ composer install --no-dev --no-interaction
|
||||||
|
|
||||||
git_build=""
|
git_build=""
|
||||||
if [ -d .git ]; then
|
if [ -d .git ]; then
|
||||||
echo " * Building from Git"
|
echo " * Building from Git"
|
||||||
git_build="y"
|
git_build="y"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${git_build}" = "y" ]; then
|
if [ "${git_build}" = "y" ]; then
|
||||||
git_version=`git tag --points-at HEAD`
|
git_version=$(git tag --points-at HEAD)
|
||||||
echo " * Version from tag: ${git_version}"
|
echo " * Version from tag: ${git_version}"
|
||||||
if [ "${git_version}" = "" ]; then
|
if [ "${git_version}" = "" ]; then
|
||||||
git_version=`git rev-parse --short HEAD`
|
git_version=$(git rev-parse --short HEAD)
|
||||||
echo " * Overriding empty version with sha1 commit-ish: ${git_version}"
|
echo " * Overriding empty version with sha1 commit-ish: ${git_version}"
|
||||||
fi
|
fi
|
||||||
echo ${git_version} > VERSION
|
echo ${git_version} > VERSION
|
||||||
else
|
else
|
||||||
# if no file was in tarball we create one letting the user know
|
# if no file was in tarball we create one letting the user know
|
||||||
# if you run in to this you should grab an enriched tarball built
|
# if you run in to this you should grab an enriched tarball built
|
||||||
# by travis. It already contains the VERSION file and also bundles
|
# by travis. It already contains the VERSION file and also bundles
|
||||||
# all the PHP you vendors files making the install much faster on
|
# all the PHP you vendors files making the install much faster on
|
||||||
# your part.
|
# your part.
|
||||||
if [ ! -f VERSION ]; then
|
if [ ! -f VERSION ]; then
|
||||||
echo "could not detect version for VERSION file" > VERSION
|
echo "could not detect version for VERSION file" > VERSION
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
apt-get install -y --force-yes lsb-release sudo
|
apt-get install -y --force-yes lsb-release sudo
|
||||||
dist=`lsb_release -is`
|
dist=$(lsb_release -is)
|
||||||
code=`lsb_release -cs`
|
code=$(lsb_release -cs)
|
||||||
cpu=`getconf LONG_BIT`
|
cpu=$(getconf LONG_BIT)
|
||||||
cpuvalue=
|
cpuvalue=
|
||||||
|
|
||||||
#enable apt.sourcefabric.org source
|
#enable apt.sourcefabric.org source
|
||||||
|
@ -11,41 +11,39 @@ grep -E "deb http://apt.sourcefabric.org $code main" /etc/apt/sources.list
|
||||||
returncode=$?
|
returncode=$?
|
||||||
set -e
|
set -e
|
||||||
if [ "$returncode" -ne "0" ]; then
|
if [ "$returncode" -ne "0" ]; then
|
||||||
echo "deb http://apt.sourcefabric.org $code main" >> /etc/apt/sources.list
|
echo "deb http://apt.sourcefabric.org $code main" >> /etc/apt/sources.list
|
||||||
fi
|
fi
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get -y --force-yes install sourcefabric-keyring
|
apt-get -y --force-yes install sourcefabric-keyring
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$dist" = "Ubuntu" ]; then
|
if [ "$dist" = "Ubuntu" ]; then
|
||||||
set +e
|
set +e
|
||||||
grep -E "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" /etc/apt/sources.list
|
grep -E "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" /etc/apt/sources.list
|
||||||
returncode=$?
|
returncode=$?
|
||||||
set -e
|
set -e
|
||||||
if [ "$returncode" -ne "0" ]; then
|
if [ "$returncode" -ne "0" ]; then
|
||||||
echo "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" >> /etc/apt/sources.list
|
echo "deb http://ca.archive.ubuntu.com/ubuntu/ $code multiverse" >> /etc/apt/sources.list
|
||||||
echo "deb http://ca.archive.ubuntu.com/ubuntu/ $code universe" >> /etc/apt/sources.list
|
echo "deb http://ca.archive.ubuntu.com/ubuntu/ $code universe" >> /etc/apt/sources.list
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#enable squeeze backports to get lame packages
|
#enable squeeze backports to get lame packages
|
||||||
if [ "$dist" = "Debian" -a "$code" = "squeeze" ]; then
|
if [ "$dist" = "Debian" -a "$code" = "squeeze" ]; then
|
||||||
set +e
|
set +e
|
||||||
grep -E "deb http://backports.debian.org/debian-backports squeeze-backports main" /etc/apt/sources.list
|
grep -E "deb http://backports.debian.org/debian-backports squeeze-backports main" /etc/apt/sources.list
|
||||||
returncode=$?
|
returncode=$?
|
||||||
set -e
|
set -e
|
||||||
if [ "$returncode" -ne "0" ]; then
|
if [ "$returncode" -ne "0" ]; then
|
||||||
echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
|
echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "System is $cpu bit..."
|
echo "System is $cpu bit..."
|
||||||
if [ "$cpu" = "64" ]; then
|
if [ "$cpu" = "64" ]; then
|
||||||
cpuvalue="amd64"
|
cpuvalue="amd64"
|
||||||
else
|
else
|
||||||
cpuvalue="i386"
|
cpuvalue="i386"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
|
@ -62,14 +60,14 @@ apt-get -y --force-yes install libopus0 libopus-dev libopus-dbg libopus-doc
|
||||||
#obsoleted code end
|
#obsoleted code end
|
||||||
|
|
||||||
apt-get -y --force-yes install git-core ocaml-findlib libao-ocaml-dev \
|
apt-get -y --force-yes install git-core ocaml-findlib libao-ocaml-dev \
|
||||||
libportaudio-ocaml-dev libmad-ocaml-dev libtaglib-ocaml-dev libalsa-ocaml-dev \
|
libportaudio-ocaml-dev libmad-ocaml-dev libtaglib-ocaml-dev libalsa-ocaml-dev \
|
||||||
libvorbis-ocaml-dev libladspa-ocaml-dev libxmlplaylist-ocaml-dev libflac-dev \
|
libvorbis-ocaml-dev libladspa-ocaml-dev libxmlplaylist-ocaml-dev libflac-dev \
|
||||||
libxml-dom-perl libxml-dom-xpath-perl patch autoconf libmp3lame-dev \
|
libxml-dom-perl libxml-dom-xpath-perl patch autoconf libmp3lame-dev \
|
||||||
libcamomile-ocaml-dev libcamlimages-ocaml-dev libtool libpulse-dev camlidl \
|
libcamomile-ocaml-dev libcamlimages-ocaml-dev libtool libpulse-dev camlidl \
|
||||||
libfaad-dev libpcre-ocaml-dev libfftw3-3 dialog
|
libfaad-dev libpcre-ocaml-dev libfftw3-3 dialog
|
||||||
|
|
||||||
if [ "$code" != "lucid" ]; then
|
if [ "$code" != "lucid" ]; then
|
||||||
apt-get -y --force-yes install libvo-aacenc-dev
|
apt-get -y --force-yes install libvo-aacenc-dev
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#dpkg -i libopus-dbg_1.0.1~$code~sfo-1_$cpuvalue.deb libopus-dev_1.0.1~$code~sfo-1_$cpuvalue.deb libopus0_1.0.1~$code~sfo-1_$cpuvalue.deb aacplusenc_0.17.5-0.0medibuntu1_$cpuvalue.deb
|
#dpkg -i libopus-dbg_1.0.1~$code~sfo-1_$cpuvalue.deb libopus-dev_1.0.1~$code~sfo-1_$cpuvalue.deb libopus0_1.0.1~$code~sfo-1_$cpuvalue.deb aacplusenc_0.17.5-0.0medibuntu1_$cpuvalue.deb
|
||||||
|
@ -111,7 +109,7 @@ sed -i "s/#ocaml-opus/ocaml-opus/g" PACKAGES
|
||||||
#sed -i "s/#ocaml-aacplus/ocaml-aacplus/g" PACKAGES
|
#sed -i "s/#ocaml-aacplus/ocaml-aacplus/g" PACKAGES
|
||||||
#sed -i "s/#ocaml-shine/ocaml-shine/g" PACKAGES
|
#sed -i "s/#ocaml-shine/ocaml-shine/g" PACKAGES
|
||||||
if [ "$code" != "lucid" ]; then
|
if [ "$code" != "lucid" ]; then
|
||||||
sed -i "s/#ocaml-voaacenc/ocaml-voaacenc/g" PACKAGES
|
sed -i "s/#ocaml-voaacenc/ocaml-voaacenc/g" PACKAGES
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R tmp /liquidsoap-full
|
chown -R tmp /liquidsoap-full
|
||||||
|
|
|
@ -5,88 +5,88 @@ exec 2>&1
|
||||||
ROOT_UID="0"
|
ROOT_UID="0"
|
||||||
|
|
||||||
#Check if run as root
|
#Check if run as root
|
||||||
if [ "$UID" -ne "$ROOT_UID" ] ; then
|
if [ "$UID" -ne "$ROOT_UID" ]; then
|
||||||
echo "You must have 'sudo' right to do that!"
|
echo "You must have 'sudo' right to do that!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf ./liquidsoap-compile_logs
|
rm -rf ./liquidsoap-compile_logs
|
||||||
mkdir -p ./liquidsoap-compile_logs
|
mkdir -p ./liquidsoap-compile_logs
|
||||||
|
|
||||||
showhelp () {
|
showhelp() {
|
||||||
echo "Usage: run.sh [options] [parameters]
|
echo "Usage: run.sh [options] [parameters]
|
||||||
-c all|ubuntu_lucid_32 Compile liquidsoap on all platforms or specified platform.
|
-c all|ubuntu_lucid_32 Compile liquidsoap on all platforms or specified platform.
|
||||||
-b all|ubuntu_lucid_32 Build shroot environments for all platforms or specified platform.
|
-b all|ubuntu_lucid_32 Build shroot environments for all platforms or specified platform.
|
||||||
-u username Local username will be used as sudo user of chroot env. Must be assigned before -b options"
|
-u username Local username will be used as sudo user of chroot env. Must be assigned before -b options"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
build_env () {
|
build_env() {
|
||||||
if [ $sudo_user = "-1" ];then
|
if [ $sudo_user = "-1" ]; then
|
||||||
echo "Please use -u to assign sudo username before build environments."
|
echo "Please use -u to assign sudo username before build environments."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "build_env $1"
|
echo "build_env $1"
|
||||||
#exec > >(tee ./liquidsoap_compile_logs/build_env_$1.log)
|
#exec > >(tee ./liquidsoap_compile_logs/build_env_$1.log)
|
||||||
os=`echo $1 | awk '/(debian)/'`
|
os=$(echo $1 | awk '/(debian)/')
|
||||||
cpu=`echo $1 | awk '/(64)/'`
|
cpu=$(echo $1 | awk '/(64)/')
|
||||||
dist=`echo $1 | awk -F "_" '{print $2}'`
|
dist=$(echo $1 | awk -F "_" '{print $2}')
|
||||||
|
|
||||||
rm -f /etc/schroot/chroot.d/$1.conf
|
rm -f /etc/schroot/chroot.d/$1.conf
|
||||||
if cat /etc/passwd | awk -F:'{print $1}' | grep "tmp" >/dev/null 2>&1;then
|
if cat /etc/passwd | awk -F:'{print $1}' | grep "tmp" > /dev/null 2>&1; then
|
||||||
echo "User tmp exists."
|
echo "User tmp exists."
|
||||||
|
else
|
||||||
|
useradd tmp
|
||||||
|
echo "User tmp is created."
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-get update
|
||||||
|
apt-get --force-yes -y install debootstrap dchroot
|
||||||
|
echo [$1] > /etc/schroot/chroot.d/$1.conf
|
||||||
|
echo description=$1 >> /etc/schroot/chroot.d/$1.conf
|
||||||
|
echo directory=/srv/chroot/$1 >> /etc/schroot/chroot.d/$1.conf
|
||||||
|
echo type=directory >> /etc/schroot/chroot.d/$1.conf
|
||||||
|
echo users=$sudo_user,tmp >> /etc/schroot/chroot.d/$1.conf
|
||||||
|
echo root-users=$sudo_user >> /etc/schroot/chroot.d/$1.conf
|
||||||
|
rm -rf /srv/chroot/$1
|
||||||
|
mkdir -p /srv/chroot/$1
|
||||||
|
|
||||||
|
#cp liquidsoap_compile.sh /srv/chroot/$1/
|
||||||
|
if [ "$os" = "" ]; then
|
||||||
|
if [ "$cpu" = "" ]; then
|
||||||
|
echo "debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/"
|
||||||
|
debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/
|
||||||
else
|
else
|
||||||
useradd tmp
|
echo "debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/"
|
||||||
echo "User tmp is created."
|
debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
apt-get update
|
if [ "$cpu" = "" ]; then
|
||||||
apt-get --force-yes -y install debootstrap dchroot
|
echo "debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://ftp.debian.com/debian/"
|
||||||
echo [$1] > /etc/schroot/chroot.d/$1.conf
|
debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://ftp.debian.com/debian/
|
||||||
echo description=$1 >> /etc/schroot/chroot.d/$1.conf
|
|
||||||
echo directory=/srv/chroot/$1 >> /etc/schroot/chroot.d/$1.conf
|
|
||||||
echo type=directory >> /etc/schroot/chroot.d/$1.conf
|
|
||||||
echo users=$sudo_user,tmp >> /etc/schroot/chroot.d/$1.conf
|
|
||||||
echo root-users=$sudo_user >> /etc/schroot/chroot.d/$1.conf
|
|
||||||
rm -rf /srv/chroot/$1
|
|
||||||
mkdir -p /srv/chroot/$1
|
|
||||||
|
|
||||||
#cp liquidsoap_compile.sh /srv/chroot/$1/
|
|
||||||
if [ "$os" = "" ];then
|
|
||||||
if [ "$cpu" = "" ];then
|
|
||||||
echo "debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/"
|
|
||||||
debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/
|
|
||||||
else
|
|
||||||
echo "debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/"
|
|
||||||
debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://archive.ubuntu.com/ubuntu/
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
if [ "$cpu" = "" ];then
|
echo "debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://ftp.debian.com/debian/"
|
||||||
echo "debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://ftp.debian.com/debian/"
|
debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://ftp.debian.com/debian/
|
||||||
debootstrap --variant=buildd --arch=i386 $dist /srv/chroot/$1 http://ftp.debian.com/debian/
|
|
||||||
else
|
|
||||||
echo "debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://ftp.debian.com/debian/"
|
|
||||||
debootstrap --variant=buildd --arch=amd64 $dist /srv/chroot/$1 http://ftp.debian.com/debian/
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compile_liq () {
|
compile_liq() {
|
||||||
echo "complie_liq $1"
|
echo "complie_liq $1"
|
||||||
#exec > >(tee ./liquidsoap_compile_logs/compile_liq_$1.log)
|
#exec > >(tee ./liquidsoap_compile_logs/compile_liq_$1.log)
|
||||||
binfilename=`echo $1 | sed -e 's/ubuntu/liquidsoap/g' -e 's/debian/liquidsoap/g' -e 's/32/i386/g' -e 's/64/amd64/g'`
|
binfilename=$(echo $1 | sed -e 's/ubuntu/liquidsoap/g' -e 's/debian/liquidsoap/g' -e 's/32/i386/g' -e 's/64/amd64/g')
|
||||||
rm -f /srv/chroot/$1/liquidsoap-compile.sh
|
rm -f /srv/chroot/$1/liquidsoap-compile.sh
|
||||||
rm -f /srv/chroot/$1/liquidsoap
|
rm -f /srv/chroot/$1/liquidsoap
|
||||||
cp liquidsoap-compile.sh /srv/chroot/$1/
|
cp liquidsoap-compile.sh /srv/chroot/$1/
|
||||||
schroot -c $1 -u root -d / -- /liquidsoap-compile.sh
|
schroot -c $1 -u root -d / -- /liquidsoap-compile.sh
|
||||||
cp /srv/chroot/$1/liquidsoap ./$binfilename
|
cp /srv/chroot/$1/liquidsoap ./$binfilename
|
||||||
if [ $? = 0 ];then
|
if [ $? = 0 ]; then
|
||||||
echo "$binfilename is generated successfully"
|
echo "$binfilename is generated successfully"
|
||||||
else
|
else
|
||||||
mv ./liquidsoap-compile_logs/compile_liq_$1.log ./liquidsoap-compile_logs/fail_to_compile_liq_$1.log
|
mv ./liquidsoap-compile_logs/compile_liq_$1.log ./liquidsoap-compile_logs/fail_to_compile_liq_$1.log
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
os_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_precise_32" "ubuntu_precise_64" "ubuntu_quantal_32" "ubuntu_quantal_64" "ubuntu_raring_32" "ubuntu_raring_64" "debian_squeeze_32" "debian_squeeze_64" "debian_wheezy_32" "debian_wheezy_64")
|
os_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_precise_32" "ubuntu_precise_64" "ubuntu_quantal_32" "ubuntu_quantal_64" "ubuntu_raring_32" "ubuntu_raring_64" "debian_squeeze_32" "debian_squeeze_64" "debian_wheezy_32" "debian_wheezy_64")
|
||||||
|
@ -96,74 +96,67 @@ flag=
|
||||||
os=
|
os=
|
||||||
sudo_user="-1"
|
sudo_user="-1"
|
||||||
|
|
||||||
if [ x$1 = x ];then
|
if [ x$1 = x ]; then
|
||||||
showhelp
|
showhelp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts b:c:u: arg
|
while getopts b:c:u: arg; do
|
||||||
do
|
case $arg in
|
||||||
case $arg in
|
b)
|
||||||
b)
|
if [ "$OPTARG" = "all" ]; then
|
||||||
if [ "$OPTARG" = "all" ];then
|
echo "Building all platforms on server..."
|
||||||
echo "Building all platforms on server..."
|
for i in $(seq 0 $(($num - 1))); do
|
||||||
for i in $(seq 0 $(($num -1)));
|
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
||||||
do
|
done
|
||||||
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
else
|
||||||
done
|
flag=1
|
||||||
else
|
for i in $(seq 0 $(($num - 1))); do
|
||||||
flag=1
|
if [ "$OPTARG" = ${os_versions[$i]} ]; then
|
||||||
for i in $(seq 0 $(($num -1)));
|
echo "Building platform: $OPTARG ..."
|
||||||
do
|
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
||||||
if [ "$OPTARG" = ${os_versions[$i]} ];then
|
flag=0
|
||||||
echo "Building platform: $OPTARG ..."
|
fi
|
||||||
build_env ${os_versions[$i]} | tee ./liquidsoap-compile_logs/build_env_${os_versions[$i]}.log
|
done
|
||||||
flag=0
|
if [ $flag = 1 ]; then
|
||||||
fi
|
echo "Unsupported Platform from:"
|
||||||
done
|
for j in "${os_versions[@]}"; do
|
||||||
if [ $flag = 1 ];then
|
echo $j
|
||||||
echo "Unsupported Platform from:"
|
done
|
||||||
for j in "${os_versions[@]}"
|
exit 1
|
||||||
do
|
fi
|
||||||
echo $j
|
fi
|
||||||
done
|
;;
|
||||||
exit 1
|
c)
|
||||||
fi
|
if [ "$OPTARG" = "all" ]; then
|
||||||
fi
|
echo "Compiling liquidsoap for all platforms on server..."
|
||||||
;;
|
for i in $(seq 0 $(($num - 1))); do
|
||||||
c)
|
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
||||||
if [ "$OPTARG" = "all" ];then
|
done
|
||||||
echo "Compiling liquidsoap for all platforms on server..."
|
|
||||||
for i in $(seq 0 $(($num -1)))
|
|
||||||
do
|
|
||||||
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
|
||||||
done
|
|
||||||
|
|
||||||
else
|
else
|
||||||
flag=1
|
flag=1
|
||||||
for i in $(seq 0 $(($num -1)));
|
for i in $(seq 0 $(($num - 1))); do
|
||||||
do
|
if [ "$OPTARG" = ${os_versions[$i]} ]; then
|
||||||
if [ "$OPTARG" = ${os_versions[$i]} ];then
|
echo "Compiling liquidsoap for platform: $OPTARG ..."
|
||||||
echo "Compiling liquidsoap for platform: $OPTARG ..."
|
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
||||||
compile_liq ${os_versions[$i]} | tee ./liquidsoap-compile_logs/compile_liq_${os_versions[$i]}.log
|
flag=0
|
||||||
flag=0
|
fi
|
||||||
fi
|
done
|
||||||
done
|
if [ $flag = 1 ]; then
|
||||||
if [ $flag = 1 ];then
|
echo "Unsupported Platform from:"
|
||||||
echo "Unsupported Platform from:"
|
for k in "${os_versions[@]}"; do
|
||||||
for k in "${os_versions[@]}"
|
echo $k
|
||||||
do
|
done
|
||||||
echo $k
|
exit 1
|
||||||
done
|
fi
|
||||||
exit 1
|
fi
|
||||||
fi
|
;;
|
||||||
fi
|
u)
|
||||||
;;
|
sudo_user="$OPTARG"
|
||||||
u)
|
echo "sudo_user is set as $sudo_user."
|
||||||
sudo_user="$OPTARG"
|
;;
|
||||||
echo "sudo_user is set as $sudo_user."
|
?)
|
||||||
;;
|
showhelp
|
||||||
?)
|
;;
|
||||||
showhelp
|
esac
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
|
|
|
@ -10,16 +10,15 @@ baseurl="$1/updateAndBuild.action?buildKey="
|
||||||
# Moves to the 2nd param (first is URL)
|
# Moves to the 2nd param (first is URL)
|
||||||
shift
|
shift
|
||||||
# Loop for each build key
|
# Loop for each build key
|
||||||
while (( "$#" )); do
|
while (("$#")); do
|
||||||
|
|
||||||
#
|
#
|
||||||
# Invoke the trigger
|
# Invoke the trigger
|
||||||
#
|
#
|
||||||
remoteCall=$baseurl$1
|
remoteCall=$baseurl$1
|
||||||
echo "Detected last directory that was committed ... triggering $remoteCall"
|
echo "Detected last directory that was committed ... triggering $remoteCall"
|
||||||
/usr/bin/wget --timeout=10 -t1 $remoteCall -O /dev/null
|
/usr/bin/wget --timeout=10 -t1 $remoteCall -O /dev/null
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
# Absolute path to this script
|
# Absolute path to this script
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=$(readlink -f $0)
|
||||||
# Absolute directory this script is in
|
# Absolute directory this script is in
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
SCRIPTPATH=$(dirname $SCRIPT)
|
||||||
|
|
||||||
cd $SCRIPTPATH/../airtime_mvc/
|
cd $SCRIPTPATH/../airtime_mvc/
|
||||||
path=`pwd`
|
path=$(pwd)
|
||||||
cd build
|
cd build
|
||||||
sed -i s#"project\.home =.*$"#"project.home = $path"#g build.properties
|
sed -i s:"project\.home =.*$":"project.home = $path":g build.properties
|
||||||
../../vendor/propel/propel1/generator/bin/propel-gen
|
../../vendor/propel/propel1/generator/bin/propel-gen
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
#creates tarballs with a "1.8.2-RC" suffix
|
#creates tarballs with a "1.8.2-RC" suffix
|
||||||
|
|
||||||
if [ $# == 0 ]; then
|
if [ $# == 0 ]; then
|
||||||
echo "Zero arguments"
|
echo "Zero arguments"
|
||||||
exit
|
exit
|
||||||
elif [ $# == 1 ]; then
|
elif [ $# == 1 ]; then
|
||||||
suffix=$1
|
suffix=$1
|
||||||
version=$1
|
version=$1
|
||||||
else
|
else
|
||||||
suffix=$1-$2
|
suffix=$1-$2
|
||||||
version=$1
|
version=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dir=$(dirname $(readlink -f $0))
|
dir=$(dirname $(readlink -f $0))
|
||||||
|
@ -64,19 +64,18 @@ pushd /tmp/
|
||||||
find libretime-${suffix} -type f -exec dos2unix {} \;
|
find libretime-${suffix} -type f -exec dos2unix {} \;
|
||||||
echo -n "Creating tarball..."
|
echo -n "Creating tarball..."
|
||||||
tar -czf $target_file \
|
tar -czf $target_file \
|
||||||
--owner=root --group=root \
|
--owner=root --group=root \
|
||||||
--exclude-vcs \
|
--exclude-vcs \
|
||||||
--exclude .zfproject.xml \
|
--exclude .zfproject.xml \
|
||||||
--exclude .gitignore \
|
--exclude .gitignore \
|
||||||
--exclude .gitattributes \
|
--exclude .gitattributes \
|
||||||
--exclude .travis.yml \
|
--exclude .travis.yml \
|
||||||
--exclude travis \
|
--exclude travis \
|
||||||
--exclude dev_tools \
|
--exclude dev_tools \
|
||||||
--exclude vendor/phing \
|
--exclude vendor/phing \
|
||||||
--exclude vendor/simplepie/simplepie/tests \
|
--exclude vendor/simplepie/simplepie/tests \
|
||||||
libretime-${suffix}
|
libretime-${suffix}
|
||||||
echo " Done"
|
echo " Done"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|
||||||
echo "Output file available at $target_file"
|
echo "Output file available at $target_file"
|
||||||
|
|
|
@ -1,38 +1,37 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "This script must be run as root." 1>&2
|
echo "This script must be run as root." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
usage () {
|
usage() {
|
||||||
echo "Use --enable <user> or --disable flag. Enable is to set up environment"
|
echo "Use --enable <user> or --disable flag. Enable is to set up environment"
|
||||||
echo "for specified user. --disable is to reset it back to pypo user"
|
echo "for specified user. --disable is to reset it back to pypo user"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "--enable" ]; then
|
if [ "$1" = "--enable" ]; then
|
||||||
|
|
||||||
/etc/init.d/airtime-playout stop
|
/etc/init.d/airtime-playout stop
|
||||||
/etc/init.d/airtime-playout start-liquidsoap
|
/etc/init.d/airtime-playout start-liquidsoap
|
||||||
|
|
||||||
user=$2
|
user=$2
|
||||||
|
|
||||||
echo "Changing ownership to user $1"
|
echo "Changing ownership to user $1"
|
||||||
chmod -R a+rw /var/log/airtime/pypo
|
chmod -R a+rw /var/log/airtime/pypo
|
||||||
chmod a+r /etc/airtime/airtime.conf
|
chmod a+r /etc/airtime/airtime.conf
|
||||||
chown -Rv $user:$user /var/tmp/airtime/pypo/
|
chown -Rv $user:$user /var/tmp/airtime/pypo/
|
||||||
chmod -v a+r /etc/airtime/api_client.cfg
|
chmod -v a+r /etc/airtime/api_client.cfg
|
||||||
elif [ "$1" = "--disable" ]; then
|
elif [ "$1" = "--disable" ]; then
|
||||||
|
|
||||||
user="pypo"
|
user="pypo"
|
||||||
|
|
||||||
echo "Changing ownership to user $1"
|
echo "Changing ownership to user $1"
|
||||||
chmod 644 /etc/airtime/airtime.conf
|
chmod 644 /etc/airtime/airtime.conf
|
||||||
chown -Rv $user:$user /var/tmp/airtime/pypo/
|
chown -Rv $user:$user /var/tmp/airtime/pypo/
|
||||||
chmod -v a+r /etc/airtime/api_client.cfg
|
chmod -v a+r /etc/airtime/api_client.cfg
|
||||||
|
|
||||||
|
/etc/init.d/airtime-playout stop-liquidsoap
|
||||||
/etc/init.d/airtime-playout stop-liquidsoap
|
/etc/init.d/airtime-playout start
|
||||||
/etc/init.d/airtime-playout start
|
|
||||||
else
|
else
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
#return with a non-zero return value.
|
#return with a non-zero return value.
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "Please run as root user."
|
echo "Please run as root user."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dist=$1
|
dist=$1
|
||||||
|
@ -52,9 +52,9 @@ echo "...Done"
|
||||||
|
|
||||||
IP=$(lxc-info -i -n ${name} -H)
|
IP=$(lxc-info -i -n ${name} -H)
|
||||||
echo -e "\n * Opening ${name} in your browser..."
|
echo -e "\n * Opening ${name} in your browser..."
|
||||||
if hash xdg-open 2>/dev/null; then
|
if hash xdg-open 2> /dev/null; then
|
||||||
xdg-open "http://${IP}/"
|
xdg-open "http://${IP}/"
|
||||||
elif hash gnome-open 2>/dev/null; then
|
elif hash gnome-open 2> /dev/null; then
|
||||||
gnome-open "http://${IP}/"
|
gnome-open "http://${IP}/"
|
||||||
fi
|
fi
|
||||||
echo "...Done"
|
echo "...Done"
|
||||||
|
|
|
@ -9,15 +9,15 @@ dnf config-manager --enable powertools
|
||||||
|
|
||||||
# xiph multimedia (for icecast)
|
# xiph multimedia (for icecast)
|
||||||
curl -o /etc/yum.repos.d/multimedia:xiph.repo \
|
curl -o /etc/yum.repos.d/multimedia:xiph.repo \
|
||||||
https://download.opensuse.org/repositories/multimedia:/xiph/CentOS_8/multimedia:xiph.repo
|
https://download.opensuse.org/repositories/multimedia:/xiph/CentOS_8/multimedia:xiph.repo
|
||||||
|
|
||||||
# RaBe Liquidsoap Distribution (RaBe LSD)
|
# RaBe Liquidsoap Distribution (RaBe LSD)
|
||||||
curl -o /etc/yum.repos.d/home:radiorabe:liquidsoap.repo \
|
curl -o /etc/yum.repos.d/home:radiorabe:liquidsoap.repo \
|
||||||
https://download.opensuse.org/repositories/home:/radiorabe:/liquidsoap/CentOS_8/home:radiorabe:liquidsoap.repo
|
https://download.opensuse.org/repositories/home:/radiorabe:/liquidsoap/CentOS_8/home:radiorabe:liquidsoap.repo
|
||||||
|
|
||||||
# RaBe Audio Packages for Enterprise Linux (RaBe APEL)
|
# RaBe Audio Packages for Enterprise Linux (RaBe APEL)
|
||||||
curl -o /etc/yum.repos.d/home:radiorabe:audio.repo \
|
curl -o /etc/yum.repos.d/home:radiorabe:audio.repo \
|
||||||
https://download.opensuse.org/repositories/home:/radiorabe:/audio/CentOS_8/home:radiorabe:audio.repo
|
https://download.opensuse.org/repositories/home:/radiorabe:/audio/CentOS_8/home:radiorabe:audio.repo
|
||||||
|
|
||||||
# Update all the things (just to be sure we are on latest)
|
# Update all the things (just to be sure we are on latest)
|
||||||
yum update -y
|
yum update -y
|
||||||
|
@ -58,7 +58,6 @@ su -l postgres bash -c 'createdb -O airtime airtime'
|
||||||
echo "ALTER USER airtime WITH PASSWORD 'airtime';" | su -l postgres bash -c psql
|
echo "ALTER USER airtime WITH PASSWORD 'airtime';" | su -l postgres bash -c psql
|
||||||
echo "GRANT ALL PRIVILEGES ON DATABASE airtime TO airtime;" | su -l postgres bash -c psql
|
echo "GRANT ALL PRIVILEGES ON DATABASE airtime TO airtime;" | su -l postgres bash -c psql
|
||||||
|
|
||||||
|
|
||||||
# RabbitMQ
|
# RabbitMQ
|
||||||
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
|
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
|
||||||
yum install -y rabbitmq-server
|
yum install -y rabbitmq-server
|
||||||
|
@ -142,7 +141,6 @@ sed -i \
|
||||||
-e 's/LoadModule mpm_event_module/#LoadModule mpm_event_module/' \
|
-e 's/LoadModule mpm_event_module/#LoadModule mpm_event_module/' \
|
||||||
/etc/httpd/conf.modules.d/00-mpm.conf
|
/etc/httpd/conf.modules.d/00-mpm.conf
|
||||||
|
|
||||||
|
|
||||||
# celery will not run unless we install a specific version (https://github.com/pypa/setuptools/issues/942)
|
# celery will not run unless we install a specific version (https://github.com/pypa/setuptools/issues/942)
|
||||||
# this will need to be figured out later on and will get overridden by the docs installer anyhow :(
|
# this will need to be figured out later on and will get overridden by the docs installer anyhow :(
|
||||||
pip3 install setuptools==33.1.1
|
pip3 install setuptools==33.1.1
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#
|
#
|
||||||
# See http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#generic-init-scripts
|
# See http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#generic-init-scripts
|
||||||
|
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: celeryd
|
# Provides: celeryd
|
||||||
# Required-Start: $network $local_fs $remote_fs
|
# Required-Start: $network $local_fs $remote_fs
|
||||||
|
@ -31,19 +30,19 @@
|
||||||
VERSION=10.1
|
VERSION=10.1
|
||||||
echo "celery init v${VERSION}."
|
echo "celery init v${VERSION}."
|
||||||
if [ $(id -u) -ne 0 ]; then
|
if [ $(id -u) -ne 0 ]; then
|
||||||
echo "Error: This program can only be used by the root user."
|
echo "Error: This program can only be used by the root user."
|
||||||
echo " Unprivileged users must use the 'celery multi' utility, "
|
echo " Unprivileged users must use the 'celery multi' utility, "
|
||||||
echo " or 'celery worker --detach'."
|
echo " or 'celery worker --detach'."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export RMQ_CONFIG_FILE="/etc/airtime/airtime.conf"
|
export RMQ_CONFIG_FILE="/etc/airtime/airtime.conf"
|
||||||
|
|
||||||
# Can be a runlevel symlink (e.g. S02celeryd)
|
# Can be a runlevel symlink (e.g. S02celeryd)
|
||||||
if [ -L "$0" ]; then
|
if [ -L "$0" ]; then
|
||||||
SCRIPT_FILE=$(readlink "$0")
|
SCRIPT_FILE=$(readlink "$0")
|
||||||
else
|
else
|
||||||
SCRIPT_FILE="$0"
|
SCRIPT_FILE="$0"
|
||||||
fi
|
fi
|
||||||
SCRIPT_NAME="$(basename "$SCRIPT_FILE")"
|
SCRIPT_NAME="$(basename "$SCRIPT_FILE")"
|
||||||
|
|
||||||
|
@ -57,53 +56,53 @@ DEFAULT_CELERYD="-m celery worker --detach"
|
||||||
CELERY_DEFAULTS=${CELERY_DEFAULTS:-"/etc/default/${SCRIPT_NAME}"}
|
CELERY_DEFAULTS=${CELERY_DEFAULTS:-"/etc/default/${SCRIPT_NAME}"}
|
||||||
# Make sure executable configuration script is owned by root
|
# Make sure executable configuration script is owned by root
|
||||||
_config_sanity() {
|
_config_sanity() {
|
||||||
local path="$1"
|
local path="$1"
|
||||||
local owner=$(ls -ld "$path" | awk '{print $3}')
|
local owner=$(ls -ld "$path" | awk '{print $3}')
|
||||||
local iwgrp=$(ls -ld "$path" | cut -b 6)
|
local iwgrp=$(ls -ld "$path" | cut -b 6)
|
||||||
local iwoth=$(ls -ld "$path" | cut -b 9)
|
local iwoth=$(ls -ld "$path" | cut -b 9)
|
||||||
if [ "$(id -u $owner)" != "0" ]; then
|
if [ "$(id -u $owner)" != "0" ]; then
|
||||||
echo "Error: Config script '$path' must be owned by root!"
|
echo "Error: Config script '$path' must be owned by root!"
|
||||||
echo
|
echo
|
||||||
echo "Resolution:"
|
echo "Resolution:"
|
||||||
echo "Review the file carefully and make sure it has not been "
|
echo "Review the file carefully and make sure it has not been "
|
||||||
echo "modified with mailicious intent. When sure the "
|
echo "modified with mailicious intent. When sure the "
|
||||||
echo "script is safe to execute with superuser privileges "
|
echo "script is safe to execute with superuser privileges "
|
||||||
echo "you can change ownership of the script:"
|
echo "you can change ownership of the script:"
|
||||||
echo " $ sudo chown root '$path'"
|
echo " $ sudo chown root '$path'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$iwoth" != "-" ]; then # S_IWOTH
|
if [ "$iwoth" != "-" ]; then # S_IWOTH
|
||||||
echo "Error: Config script '$path' cannot be writable by others!"
|
echo "Error: Config script '$path' cannot be writable by others!"
|
||||||
echo
|
echo
|
||||||
echo "Resolution:"
|
echo "Resolution:"
|
||||||
echo "Review the file carefully and make sure it has not been "
|
echo "Review the file carefully and make sure it has not been "
|
||||||
echo "modified with malicious intent. When sure the "
|
echo "modified with malicious intent. When sure the "
|
||||||
echo "script is safe to execute with superuser privileges "
|
echo "script is safe to execute with superuser privileges "
|
||||||
echo "you can change the scripts permissions:"
|
echo "you can change the scripts permissions:"
|
||||||
echo " $ sudo chmod 640 '$path'"
|
echo " $ sudo chmod 640 '$path'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$iwgrp" != "-" ]; then # S_IWGRP
|
if [ "$iwgrp" != "-" ]; then # S_IWGRP
|
||||||
echo "Error: Config script '$path' cannot be writable by group!"
|
echo "Error: Config script '$path' cannot be writable by group!"
|
||||||
echo
|
echo
|
||||||
echo "Resolution:"
|
echo "Resolution:"
|
||||||
echo "Review the file carefully and make sure it has not been "
|
echo "Review the file carefully and make sure it has not been "
|
||||||
echo "modified with malicious intent. When sure the "
|
echo "modified with malicious intent. When sure the "
|
||||||
echo "script is safe to execute with superuser privileges "
|
echo "script is safe to execute with superuser privileges "
|
||||||
echo "you can change the scripts permissions:"
|
echo "you can change the scripts permissions:"
|
||||||
echo " $ sudo chmod 640 '$path'"
|
echo " $ sudo chmod 640 '$path'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
if [ -f "$CELERY_DEFAULTS" ]; then
|
if [ -f "$CELERY_DEFAULTS" ]; then
|
||||||
_config_sanity "$CELERY_DEFAULTS"
|
_config_sanity "$CELERY_DEFAULTS"
|
||||||
echo "Using config script: $CELERY_DEFAULTS"
|
echo "Using config script: $CELERY_DEFAULTS"
|
||||||
. "$CELERY_DEFAULTS"
|
. "$CELERY_DEFAULTS"
|
||||||
fi
|
fi
|
||||||
# Sets --app argument for CELERY_BIN
|
# Sets --app argument for CELERY_BIN
|
||||||
CELERY_APP_ARG=""
|
CELERY_APP_ARG=""
|
||||||
if [ ! -z "$CELERY_APP" ]; then
|
if [ ! -z "$CELERY_APP" ]; then
|
||||||
CELERY_APP_ARG="--app=$CELERY_APP"
|
CELERY_APP_ARG="--app=$CELERY_APP"
|
||||||
fi
|
fi
|
||||||
CELERYD_USER=${CELERYD_USER:-$DEFAULT_USER}
|
CELERYD_USER=${CELERYD_USER:-$DEFAULT_USER}
|
||||||
# Set CELERY_CREATE_DIRS to always create log/pid dirs.
|
# Set CELERY_CREATE_DIRS to always create log/pid dirs.
|
||||||
|
@ -111,12 +110,12 @@ CELERY_CREATE_DIRS=${CELERY_CREATE_DIRS:-0}
|
||||||
CELERY_CREATE_RUNDIR=$CELERY_CREATE_DIRS
|
CELERY_CREATE_RUNDIR=$CELERY_CREATE_DIRS
|
||||||
CELERY_CREATE_LOGDIR=$CELERY_CREATE_DIRS
|
CELERY_CREATE_LOGDIR=$CELERY_CREATE_DIRS
|
||||||
if [ -z "$CELERYD_PID_FILE" ]; then
|
if [ -z "$CELERYD_PID_FILE" ]; then
|
||||||
CELERYD_PID_FILE="$DEFAULT_PID_FILE"
|
CELERYD_PID_FILE="$DEFAULT_PID_FILE"
|
||||||
CELERY_CREATE_RUNDIR=1
|
CELERY_CREATE_RUNDIR=1
|
||||||
fi
|
fi
|
||||||
if [ -z "$CELERYD_LOG_FILE" ]; then
|
if [ -z "$CELERYD_LOG_FILE" ]; then
|
||||||
CELERYD_LOG_FILE="$DEFAULT_LOG_FILE"
|
CELERYD_LOG_FILE="$DEFAULT_LOG_FILE"
|
||||||
CELERY_CREATE_LOGDIR=1
|
CELERY_CREATE_LOGDIR=1
|
||||||
fi
|
fi
|
||||||
CELERYD_LOG_LEVEL=${CELERYD_LOG_LEVEL:-${CELERYD_LOGLEVEL:-$DEFAULT_LOG_LEVEL}}
|
CELERYD_LOG_LEVEL=${CELERYD_LOG_LEVEL:-${CELERYD_LOGLEVEL:-$DEFAULT_LOG_LEVEL}}
|
||||||
CELERY_BIN=${CELERY_BIN:-"celery"}
|
CELERY_BIN=${CELERY_BIN:-"celery"}
|
||||||
|
@ -124,211 +123,211 @@ CELERYD_MULTI=${CELERYD_MULTI:-"$CELERY_BIN multi"}
|
||||||
CELERYD_NODES=${CELERYD_NODES:-$DEFAULT_NODES}
|
CELERYD_NODES=${CELERYD_NODES:-$DEFAULT_NODES}
|
||||||
export CELERY_LOADER
|
export CELERY_LOADER
|
||||||
if [ -n "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
CELERYD_OPTS="$CELERYD_OPTS $2"
|
CELERYD_OPTS="$CELERYD_OPTS $2"
|
||||||
fi
|
fi
|
||||||
CELERYD_LOG_DIR=`dirname $CELERYD_LOG_FILE`
|
CELERYD_LOG_DIR=$(dirname $CELERYD_LOG_FILE)
|
||||||
CELERYD_PID_DIR=`dirname $CELERYD_PID_FILE`
|
CELERYD_PID_DIR=$(dirname $CELERYD_PID_FILE)
|
||||||
# Extra start-stop-daemon options, like user/group.
|
# Extra start-stop-daemon options, like user/group.
|
||||||
if [ -n "$CELERYD_CHDIR" ]; then
|
if [ -n "$CELERYD_CHDIR" ]; then
|
||||||
DAEMON_OPTS="$DAEMON_OPTS --workdir=$CELERYD_CHDIR"
|
DAEMON_OPTS="$DAEMON_OPTS --workdir=$CELERYD_CHDIR"
|
||||||
fi
|
fi
|
||||||
check_dev_null() {
|
check_dev_null() {
|
||||||
if [ ! -c /dev/null ]; then
|
if [ ! -c /dev/null ]; then
|
||||||
echo "/dev/null is not a character device!"
|
echo "/dev/null is not a character device!"
|
||||||
exit 75 # EX_TEMPFAIL
|
exit 75 # EX_TEMPFAIL
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
maybe_die() {
|
maybe_die() {
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Exiting: $* (errno $?)"
|
echo "Exiting: $* (errno $?)"
|
||||||
exit 77 # EX_NOPERM
|
exit 77 # EX_NOPERM
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
create_default_dir() {
|
create_default_dir() {
|
||||||
if [ ! -d "$1" ]; then
|
if [ ! -d "$1" ]; then
|
||||||
echo "- Creating default directory: '$1'"
|
echo "- Creating default directory: '$1'"
|
||||||
mkdir -p "$1"
|
mkdir -p "$1"
|
||||||
maybe_die "Couldn't create directory $1"
|
maybe_die "Couldn't create directory $1"
|
||||||
echo "- Changing permissions of '$1' to 02755"
|
echo "- Changing permissions of '$1' to 02755"
|
||||||
chmod 02755 "$1"
|
chmod 02755 "$1"
|
||||||
maybe_die "Couldn't change permissions for $1"
|
maybe_die "Couldn't change permissions for $1"
|
||||||
if [ -n "$CELERYD_USER" ]; then
|
if [ -n "$CELERYD_USER" ]; then
|
||||||
echo "- Changing owner of '$1' to '$CELERYD_USER'"
|
echo "- Changing owner of '$1' to '$CELERYD_USER'"
|
||||||
chown "$CELERYD_USER" "$1"
|
chown "$CELERYD_USER" "$1"
|
||||||
maybe_die "Couldn't change owner of $1"
|
maybe_die "Couldn't change owner of $1"
|
||||||
fi
|
|
||||||
if [ -n "$CELERYD_GROUP" ]; then
|
|
||||||
echo "- Changing group of '$1' to '$CELERYD_GROUP'"
|
|
||||||
chgrp "$CELERYD_GROUP" "$1"
|
|
||||||
maybe_die "Couldn't change group of $1"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$CELERYD_GROUP" ]; then
|
||||||
|
echo "- Changing group of '$1' to '$CELERYD_GROUP'"
|
||||||
|
chgrp "$CELERYD_GROUP" "$1"
|
||||||
|
maybe_die "Couldn't change group of $1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
check_paths() {
|
check_paths() {
|
||||||
if [ $CELERY_CREATE_LOGDIR -eq 1 ]; then
|
if [ $CELERY_CREATE_LOGDIR -eq 1 ]; then
|
||||||
create_default_dir "$CELERYD_LOG_DIR"
|
create_default_dir "$CELERYD_LOG_DIR"
|
||||||
fi
|
fi
|
||||||
if [ $CELERY_CREATE_RUNDIR -eq 1 ]; then
|
if [ $CELERY_CREATE_RUNDIR -eq 1 ]; then
|
||||||
create_default_dir "$CELERYD_PID_DIR"
|
create_default_dir "$CELERYD_PID_DIR"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
create_paths() {
|
create_paths() {
|
||||||
create_default_dir "$CELERYD_LOG_DIR"
|
create_default_dir "$CELERYD_LOG_DIR"
|
||||||
create_default_dir "$CELERYD_PID_DIR"
|
create_default_dir "$CELERYD_PID_DIR"
|
||||||
}
|
}
|
||||||
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
||||||
_get_pidfiles () {
|
_get_pidfiles() {
|
||||||
# note: multi < 3.1.14 output to stderr, not stdout, hence the redirect.
|
# note: multi < 3.1.14 output to stderr, not stdout, hence the redirect.
|
||||||
${CELERYD_MULTI} expand "${CELERYD_PID_FILE}" ${CELERYD_NODES} 2>&1
|
${CELERYD_MULTI} expand "${CELERYD_PID_FILE}" ${CELERYD_NODES} 2>&1
|
||||||
}
|
}
|
||||||
_get_pids() {
|
_get_pids() {
|
||||||
found_pids=0
|
found_pids=0
|
||||||
my_exitcode=0
|
my_exitcode=0
|
||||||
for pidfile in $(_get_pidfiles); do
|
for pidfile in $(_get_pidfiles); do
|
||||||
local pid=`cat "$pidfile"`
|
local pid=$(cat "$pidfile")
|
||||||
local cleaned_pid=`echo "$pid" | sed -e 's/[^0-9]//g'`
|
local cleaned_pid=$(echo "$pid" | sed -e 's/[^0-9]//g')
|
||||||
if [ -z "$pid" ] || [ "$cleaned_pid" != "$pid" ]; then
|
if [ -z "$pid" ] || [ "$cleaned_pid" != "$pid" ]; then
|
||||||
echo "bad pid file ($pidfile)"
|
echo "bad pid file ($pidfile)"
|
||||||
one_failed=true
|
one_failed=true
|
||||||
my_exitcode=1
|
my_exitcode=1
|
||||||
else
|
else
|
||||||
found_pids=1
|
found_pids=1
|
||||||
echo "$pid"
|
echo "$pid"
|
||||||
fi
|
fi
|
||||||
if [ $found_pids -eq 0 ]; then
|
if [ $found_pids -eq 0 ]; then
|
||||||
echo "${SCRIPT_NAME}: All nodes down"
|
echo "${SCRIPT_NAME}: All nodes down"
|
||||||
exit $my_exitcode
|
exit $my_exitcode
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
_chuid () {
|
_chuid() {
|
||||||
su "$CELERYD_USER" -c "$CELERYD_MULTI $*"
|
su "$CELERYD_USER" -c "$CELERYD_MULTI $*"
|
||||||
}
|
}
|
||||||
start_workers () {
|
start_workers() {
|
||||||
if [ ! -z "$CELERYD_ULIMIT" ]; then
|
if [ ! -z "$CELERYD_ULIMIT" ]; then
|
||||||
ulimit $CELERYD_ULIMIT
|
ulimit $CELERYD_ULIMIT
|
||||||
fi
|
fi
|
||||||
_chuid $* start $CELERYD_NODES $DAEMON_OPTS \
|
_chuid $* start $CELERYD_NODES $DAEMON_OPTS \
|
||||||
--pidfile="$CELERYD_PID_FILE" \
|
--pidfile="$CELERYD_PID_FILE" \
|
||||||
--logfile="$CELERYD_LOG_FILE" \
|
--logfile="$CELERYD_LOG_FILE" \
|
||||||
--loglevel="$CELERYD_LOG_LEVEL" \
|
--loglevel="$CELERYD_LOG_LEVEL" \
|
||||||
$CELERY_APP_ARG \
|
$CELERY_APP_ARG \
|
||||||
$CELERYD_OPTS
|
$CELERYD_OPTS
|
||||||
}
|
}
|
||||||
dryrun () {
|
dryrun() {
|
||||||
(C_FAKEFORK=1 start_workers --verbose)
|
(C_FAKEFORK=1 start_workers --verbose)
|
||||||
}
|
}
|
||||||
stop_workers () {
|
stop_workers() {
|
||||||
_chuid stopwait $CELERYD_NODES --pidfile="$CELERYD_PID_FILE"
|
_chuid stopwait $CELERYD_NODES --pidfile="$CELERYD_PID_FILE"
|
||||||
}
|
}
|
||||||
restart_workers () {
|
restart_workers() {
|
||||||
_chuid restart $CELERYD_NODES $DAEMON_OPTS \
|
_chuid restart $CELERYD_NODES $DAEMON_OPTS \
|
||||||
--pidfile="$CELERYD_PID_FILE" \
|
--pidfile="$CELERYD_PID_FILE" \
|
||||||
--logfile="$CELERYD_LOG_FILE" \
|
--logfile="$CELERYD_LOG_FILE" \
|
||||||
--loglevel="$CELERYD_LOG_LEVEL" \
|
--loglevel="$CELERYD_LOG_LEVEL" \
|
||||||
$CELERY_APP_ARG \
|
$CELERY_APP_ARG \
|
||||||
$CELERYD_OPTS
|
$CELERYD_OPTS
|
||||||
}
|
}
|
||||||
kill_workers() {
|
kill_workers() {
|
||||||
_chuid kill $CELERYD_NODES --pidfile="$CELERYD_PID_FILE"
|
_chuid kill $CELERYD_NODES --pidfile="$CELERYD_PID_FILE"
|
||||||
}
|
}
|
||||||
restart_workers_graceful () {
|
restart_workers_graceful() {
|
||||||
echo "WARNING: Use with caution in production"
|
echo "WARNING: Use with caution in production"
|
||||||
echo "The workers will attempt to restart, but they may not be able to."
|
echo "The workers will attempt to restart, but they may not be able to."
|
||||||
local worker_pids=
|
local worker_pids=
|
||||||
worker_pids=`_get_pids`
|
worker_pids=$(_get_pids)
|
||||||
[ "$one_failed" ] && exit 1
|
[ "$one_failed" ] && exit 1
|
||||||
for worker_pid in $worker_pids; do
|
for worker_pid in $worker_pids; do
|
||||||
local failed=
|
local failed=
|
||||||
kill -HUP $worker_pid 2> /dev/null || failed=true
|
kill -HUP $worker_pid 2> /dev/null || failed=true
|
||||||
if [ "$failed" ]; then
|
if [ "$failed" ]; then
|
||||||
echo "${SCRIPT_NAME} worker (pid $worker_pid) could not be restarted"
|
echo "${SCRIPT_NAME} worker (pid $worker_pid) could not be restarted"
|
||||||
one_failed=true
|
one_failed=true
|
||||||
else
|
else
|
||||||
echo "${SCRIPT_NAME} worker (pid $worker_pid) received SIGHUP"
|
echo "${SCRIPT_NAME} worker (pid $worker_pid) received SIGHUP"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[ "$one_failed" ] && exit 1 || exit 0
|
[ "$one_failed" ] && exit 1 || exit 0
|
||||||
}
|
}
|
||||||
check_status () {
|
check_status() {
|
||||||
my_exitcode=0
|
my_exitcode=0
|
||||||
found_pids=0
|
found_pids=0
|
||||||
local one_failed=
|
local one_failed=
|
||||||
for pidfile in $(_get_pidfiles); do
|
for pidfile in $(_get_pidfiles); do
|
||||||
if [ ! -r $pidfile ]; then
|
if [ ! -r $pidfile ]; then
|
||||||
echo "${SCRIPT_NAME} down: no pidfiles found"
|
echo "${SCRIPT_NAME} down: no pidfiles found"
|
||||||
one_failed=true
|
one_failed=true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
local node=`basename "$pidfile" .pid`
|
local node=$(basename "$pidfile" .pid)
|
||||||
local pid=`cat "$pidfile"`
|
local pid=$(cat "$pidfile")
|
||||||
local cleaned_pid=`echo "$pid" | sed -e 's/[^0-9]//g'`
|
local cleaned_pid=$(echo "$pid" | sed -e 's/[^0-9]//g')
|
||||||
if [ -z "$pid" ] || [ "$cleaned_pid" != "$pid" ]; then
|
if [ -z "$pid" ] || [ "$cleaned_pid" != "$pid" ]; then
|
||||||
echo "bad pid file ($pidfile)"
|
echo "bad pid file ($pidfile)"
|
||||||
one_failed=true
|
one_failed=true
|
||||||
else
|
else
|
||||||
local failed=
|
local failed=
|
||||||
kill -0 $pid 2> /dev/null || failed=true
|
kill -0 $pid 2> /dev/null || failed=true
|
||||||
if [ "$failed" ]; then
|
if [ "$failed" ]; then
|
||||||
echo "${SCRIPT_NAME} (node $node) (pid $pid) is down, but pidfile exists!"
|
echo "${SCRIPT_NAME} (node $node) (pid $pid) is down, but pidfile exists!"
|
||||||
one_failed=true
|
one_failed=true
|
||||||
else
|
else
|
||||||
echo "${SCRIPT_NAME} (node $node) (pid $pid) is up..."
|
echo "${SCRIPT_NAME} (node $node) (pid $pid) is up..."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[ "$one_failed" ] && exit 1 || exit 0
|
[ "$one_failed" ] && exit 1 || exit 0
|
||||||
}
|
}
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
check_dev_null
|
check_dev_null
|
||||||
check_paths
|
check_paths
|
||||||
start_workers
|
start_workers
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
check_dev_null
|
check_dev_null
|
||||||
check_paths
|
check_paths
|
||||||
stop_workers
|
stop_workers
|
||||||
;;
|
;;
|
||||||
reload|force-reload)
|
reload | force-reload)
|
||||||
echo "Use restart"
|
echo "Use restart"
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
check_status
|
check_status
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
check_dev_null
|
check_dev_null
|
||||||
check_paths
|
check_paths
|
||||||
restart_workers
|
restart_workers
|
||||||
;;
|
;;
|
||||||
graceful)
|
graceful)
|
||||||
check_dev_null
|
check_dev_null
|
||||||
restart_workers_graceful
|
restart_workers_graceful
|
||||||
;;
|
;;
|
||||||
kill)
|
kill)
|
||||||
check_dev_null
|
check_dev_null
|
||||||
kill_workers
|
kill_workers
|
||||||
;;
|
;;
|
||||||
dryrun)
|
dryrun)
|
||||||
check_dev_null
|
check_dev_null
|
||||||
dryrun
|
dryrun
|
||||||
;;
|
;;
|
||||||
try-restart)
|
try-restart)
|
||||||
check_dev_null
|
check_dev_null
|
||||||
check_paths
|
check_paths
|
||||||
restart_workers
|
restart_workers
|
||||||
;;
|
;;
|
||||||
create-paths)
|
create-paths)
|
||||||
check_dev_null
|
check_dev_null
|
||||||
create_paths
|
create_paths
|
||||||
;;
|
;;
|
||||||
check-paths)
|
check-paths)
|
||||||
check_dev_null
|
check_dev_null
|
||||||
check_paths
|
check_paths
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/${SCRIPT_NAME} {start|stop|restart|graceful|kill|dryrun|create-paths}"
|
echo "Usage: /etc/init.d/${SCRIPT_NAME} {start|stop|restart|graceful|kill|dryrun|create-paths}"
|
||||||
exit 64 # EX_USAGE
|
exit 64 # EX_USAGE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -30,49 +30,49 @@ PIDFILE=/var/run/$NAME.pid
|
||||||
# and status_of_proc is working.
|
# and status_of_proc is working.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
start () {
|
start() {
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
|
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
|
||||||
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||||
}
|
}
|
||||||
|
|
||||||
stop () {
|
stop() {
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${1:-''}" in
|
case "${1:-''}" in
|
||||||
'start')
|
'start')
|
||||||
# start commands here
|
# start commands here
|
||||||
echo -n "Starting $NAME: "
|
echo -n "Starting $NAME: "
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'stop')
|
'stop')
|
||||||
# stop commands here
|
# stop commands here
|
||||||
echo -n "Stopping $NAME: "
|
echo -n "Stopping $NAME: "
|
||||||
stop
|
stop
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'restart')
|
'restart')
|
||||||
# restart commands here
|
# restart commands here
|
||||||
echo -n "Restarting $NAME: "
|
echo -n "Restarting $NAME: "
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'force-reload')
|
'force-reload')
|
||||||
# reload commands here
|
# reload commands here
|
||||||
echo -n "Reloading $NAME: "
|
echo -n "Reloading $NAME: "
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'status')
|
'status')
|
||||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
;;
|
;;
|
||||||
*) # no parameter specified
|
*) # no parameter specified
|
||||||
echo "Usage: $SELF start|stop|restart|status"
|
echo "Usage: $SELF start|stop|restart|status"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,49 +1,46 @@
|
||||||
#!/bin/bash -xv
|
#!/bin/bash -xv
|
||||||
|
|
||||||
post_file() {
|
post_file() {
|
||||||
#kill process after 30 minutes (360*5=30 minutes)
|
#kill process after 30 minutes (360*5=30 minutes)
|
||||||
max_retry=5
|
max_retry=5
|
||||||
retry_count=0
|
retry_count=0
|
||||||
|
|
||||||
file_path="${1}"
|
file_path="${1}"
|
||||||
# Give us write permissions on the file to prevent problems if the user
|
# Give us write permissions on the file to prevent problems if the user
|
||||||
# uploads a read-only file.
|
# uploads a read-only file.
|
||||||
chmod +w "${file_path}"
|
chmod +w "${file_path}"
|
||||||
|
|
||||||
#We must remove commas because CURL can't upload files with commas in the name
|
#We must remove commas because CURL can't upload files with commas in the name
|
||||||
# http://curl.haxx.se/mail/archive-2009-07/0029.html
|
# http://curl.haxx.se/mail/archive-2009-07/0029.html
|
||||||
stripped_file_path=${file_path//','/''}
|
stripped_file_path=${file_path//','/''}
|
||||||
mv "${file_path}" "${stripped_file_path}"
|
mv "${file_path}" "${stripped_file_path}"
|
||||||
file_path="${stripped_file_path}"
|
file_path="${stripped_file_path}"
|
||||||
filename="${file_path##*/}"
|
filename="${file_path##*/}"
|
||||||
|
|
||||||
airtime_conf_path=/etc/airtime/airtime.conf
|
airtime_conf_path=/etc/airtime/airtime.conf
|
||||||
|
|
||||||
|
#instance_path will look like 1/1384, for example
|
||||||
|
http_path=$(grep base_url ${airtime_conf_path} | awk '{print $3;}')
|
||||||
|
http_port=$(grep base_port ${airtime_conf_path} | awk '{print $3;}')
|
||||||
|
|
||||||
#instance_path will look like 1/1384, for example
|
#post request url - http://bananas.airtime.pro/rest/media, for example
|
||||||
http_path=$(grep base_url ${airtime_conf_path} | awk '{print $3;}' )
|
url=http://
|
||||||
http_port=$(grep base_port ${airtime_conf_path} | awk '{print $3;}' )
|
url+=$http_path
|
||||||
|
url+=:
|
||||||
|
url+=$http_port
|
||||||
|
url+=/rest/media
|
||||||
|
|
||||||
#post request url - http://bananas.airtime.pro/rest/media, for example
|
api_key=$(grep api_key ${airtime_conf_path} | awk '{print $3;}')
|
||||||
url=http://
|
|
||||||
url+=$http_path
|
|
||||||
url+=:
|
|
||||||
url+=$http_port
|
|
||||||
url+=/rest/media
|
|
||||||
|
|
||||||
|
# -f is needed to make curl fail if there's an HTTP error code
|
||||||
api_key=$(grep api_key ${airtime_conf_path} | awk '{print $3;}' )
|
# -L is needed to follow redirects! (just in case)
|
||||||
|
until curl -fL --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}"; do
|
||||||
# -f is needed to make curl fail if there's an HTTP error code
|
retry_count=$(($retry_count + 1))
|
||||||
# -L is needed to follow redirects! (just in case)
|
if [ $retry_count -ge $max_retry ]; then
|
||||||
until curl -fL --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}"
|
break
|
||||||
do
|
fi
|
||||||
retry_count=$[$retry_count+1]
|
sleep 5
|
||||||
if [ $retry_count -ge $max_retry ]; then
|
done
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
post_file "${1}" &
|
post_file "${1}" &
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
post_file() {
|
post_file() {
|
||||||
file_path=${1}
|
file_path=${1}
|
||||||
filename="${file_path##*/}"
|
filename="${file_path##*/}"
|
||||||
|
|
||||||
#kill process after 30 minutes (360*5=30 minutes)
|
#kill process after 30 minutes (360*5=30 minutes)
|
||||||
max_retry=10
|
max_retry=10
|
||||||
retry_count=0
|
retry_count=0
|
||||||
|
|
||||||
until curl --max-time 30 http://localhost/rest/media -u 3188BDIMPJROQP89Z0OX: -X POST -F "file=@${file_path}" -F "name=${filename}"
|
until curl --max-time 30 http://localhost/rest/media -u 3188BDIMPJROQP89Z0OX: -X POST -F "file=@${file_path}" -F "name=${filename}"; do
|
||||||
do
|
retry_count=$(($retry_count + 1))
|
||||||
retry_count=$[$retry_count+1]
|
if [ $retry_count -ge $max_retry ]; then
|
||||||
if [ $retry_count -ge $max_retry ]; then
|
break
|
||||||
break
|
fi
|
||||||
fi
|
sleep 1
|
||||||
sleep 1
|
done
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
post_file "${1}" &
|
post_file "${1}" &
|
||||||
|
|
|
@ -30,49 +30,49 @@ PIDFILE=/var/run/$NAME.pid
|
||||||
# and status_of_proc is working.
|
# and status_of_proc is working.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
start () {
|
start() {
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
|
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
|
||||||
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||||
}
|
}
|
||||||
|
|
||||||
stop () {
|
stop() {
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${1:-''}" in
|
case "${1:-''}" in
|
||||||
'start')
|
'start')
|
||||||
# start commands here
|
# start commands here
|
||||||
echo -n "Starting $NAME: "
|
echo -n "Starting $NAME: "
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'stop')
|
'stop')
|
||||||
# stop commands here
|
# stop commands here
|
||||||
echo -n "Stopping $NAME: "
|
echo -n "Stopping $NAME: "
|
||||||
stop
|
stop
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'restart')
|
'restart')
|
||||||
# restart commands here
|
# restart commands here
|
||||||
echo -n "Restarting $NAME: "
|
echo -n "Restarting $NAME: "
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'force-reload')
|
'force-reload')
|
||||||
# reload commands here
|
# reload commands here
|
||||||
echo -n "Reloading $NAME: "
|
echo -n "Reloading $NAME: "
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'status')
|
'status')
|
||||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
;;
|
;;
|
||||||
*) # no parameter specified
|
*) # no parameter specified
|
||||||
echo "Usage: $SELF start|stop|restart|status"
|
echo "Usage: $SELF start|stop|restart|status"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -30,49 +30,49 @@ PIDFILE=/var/run/$NAME.pid
|
||||||
# and status_of_proc is working.
|
# and status_of_proc is working.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
start () {
|
start() {
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
|
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
|
||||||
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||||
}
|
}
|
||||||
|
|
||||||
stop () {
|
stop() {
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${1:-''}" in
|
case "${1:-''}" in
|
||||||
'start')
|
'start')
|
||||||
# start commands here
|
# start commands here
|
||||||
echo -n "Starting $NAME: "
|
echo -n "Starting $NAME: "
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'stop')
|
'stop')
|
||||||
# stop commands here
|
# stop commands here
|
||||||
echo -n "Stopping $NAME: "
|
echo -n "Stopping $NAME: "
|
||||||
stop
|
stop
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'restart')
|
'restart')
|
||||||
# restart commands here
|
# restart commands here
|
||||||
echo -n "Restarting $NAME: "
|
echo -n "Restarting $NAME: "
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'force-reload')
|
'force-reload')
|
||||||
# reload commands here
|
# reload commands here
|
||||||
echo -n "Reloading $NAME: "
|
echo -n "Reloading $NAME: "
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'status')
|
'status')
|
||||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
;;
|
;;
|
||||||
*) # no parameter specified
|
*) # no parameter specified
|
||||||
echo "Usage: $SELF start|stop|restart|status"
|
echo "Usage: $SELF start|stop|restart|status"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
95
uninstall
95
uninstall
|
@ -3,68 +3,61 @@
|
||||||
# return with a non-zero return value.
|
# return with a non-zero return value.
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "Please run as root user."
|
echo "Please run as root user."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
getStorDirFromDatabase() {
|
getStorDirFromDatabase() {
|
||||||
# here-doc to execute this block as postgres user
|
echo $(sudo -u postgres psql -d airtime -tAc "SELECT directory FROM cc_music_dirs WHERE type='stor'")
|
||||||
result=`su postgres <<'EOF'
|
|
||||||
set +e
|
|
||||||
echo $(psql -d airtime -tAc "SELECT directory FROM cc_music_dirs WHERE type='stor'")
|
|
||||||
set -e
|
|
||||||
# don't indent this!
|
|
||||||
EOF`
|
|
||||||
echo $result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dropLibreTimeDatabase() {
|
dropLibreTimeDatabase() {
|
||||||
# here-doc to execute this block as postgres user
|
# here-doc to execute this block as postgres user
|
||||||
su postgres <<'EOF'
|
su postgres << 'EOF'
|
||||||
set +e
|
set +e
|
||||||
# DROP DATABASE cannot be executed from a function or multi-command string
|
# DROP DATABASE cannot be executed from a function or multi-command string
|
||||||
psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime_test"
|
psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime_test"
|
||||||
psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime"
|
psql -d postgres -tAc "DROP DATABASE IF EXISTS airtime"
|
||||||
psql -d postgres -tAc "DROP USER IF EXISTS airtime"
|
psql -d postgres -tAc "DROP USER IF EXISTS airtime"
|
||||||
set -e
|
set -e
|
||||||
# don't indent this!
|
# don't indent this!
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
removeRabbitmqLibreTimeSettings() {
|
removeRabbitmqLibreTimeSettings() {
|
||||||
if [ -f /etc/airtime/airtime.conf ]; then
|
if [ -f /etc/airtime/airtime.conf ]; then
|
||||||
RMQ_VHOST=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^vhost/ ) print $2}' /etc/airtime/airtime.conf)
|
RMQ_VHOST=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^vhost/ ) print $2}' /etc/airtime/airtime.conf)
|
||||||
RMQ_USER=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^user/ ) print $2}' /etc/airtime/airtime.conf)
|
RMQ_USER=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^user/ ) print $2}' /etc/airtime/airtime.conf)
|
||||||
else
|
else
|
||||||
RMQ_VHOST=/airtime
|
RMQ_VHOST=/airtime
|
||||||
RMQ_USER=airtime
|
RMQ_USER=airtime
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rabbitmqctl delete_vhost ${RMQ_VHOST}
|
rabbitmqctl delete_vhost ${RMQ_VHOST}
|
||||||
rabbitmqctl delete_user ${RMQ_USER}
|
rabbitmqctl delete_user ${RMQ_USER}
|
||||||
}
|
}
|
||||||
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "$0")" && pwd)"
|
||||||
AIRTIMEROOT=${SCRIPT_DIR}
|
AIRTIMEROOT=${SCRIPT_DIR}
|
||||||
|
|
||||||
STOR_DIR=$(getStorDirFromDatabase)
|
STOR_DIR=$(getStorDirFromDatabase)
|
||||||
|
|
||||||
FILES=(
|
FILES=(
|
||||||
"/etc/airtime"
|
"/etc/airtime"
|
||||||
"/var/log/airtime"
|
"/var/log/airtime"
|
||||||
"/usr/lib/airtime"
|
"/usr/lib/airtime"
|
||||||
"/usr/share/airtime"
|
"/usr/share/airtime"
|
||||||
"/etc/init/airtime*"
|
"/etc/init/airtime*"
|
||||||
"/etc/systemd/system/libretime*"
|
"/etc/systemd/system/libretime*"
|
||||||
"/usr/local/bin/airtime-*"
|
"/usr/local/bin/airtime-*"
|
||||||
"/usr/bin/airtime*"
|
"/usr/bin/airtime*"
|
||||||
"/etc/apache2/sites-available/airtime*"
|
"/etc/apache2/sites-available/airtime*"
|
||||||
"/etc/apache2/sites-enabled/airtime*"
|
"/etc/apache2/sites-enabled/airtime*"
|
||||||
)
|
)
|
||||||
|
|
||||||
echo -e "The following files, directories, and services will be removed:\n"
|
echo -e "The following files, directories, and services will be removed:\n"
|
||||||
for i in ${FILES[*]}; do
|
for i in ${FILES[*]}; do
|
||||||
echo $i
|
echo $i
|
||||||
done
|
done
|
||||||
echo "pip3 airtime-playout"
|
echo "pip3 airtime-playout"
|
||||||
|
|
||||||
|
@ -73,18 +66,18 @@ echo -e "\nIf your web root is not listed, you will need to manually remove it."
|
||||||
echo -e "\nThis will *permanently* remove LibreTime and all related files from your computer. \
|
echo -e "\nThis will *permanently* remove LibreTime and all related files from your computer. \
|
||||||
Any files in LibreTime directories and subdirectories will be deleted. Are you sure you want to proceed? [y/N]: \c"
|
Any files in LibreTime directories and subdirectories will be deleted. Are you sure you want to proceed? [y/N]: \c"
|
||||||
read IN
|
read IN
|
||||||
if [[ ! ( "$IN" = "y" || "$IN" = "Y" ) ]]; then
|
if [[ ! ("$IN" = "y" || "$IN" = "Y") ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${STOR_DIR}" ]; then
|
if [ -n "${STOR_DIR}" ]; then
|
||||||
echo -e "\nDo you want to remove your music storage directory ${STOR_DIR} and all of its subdirectories? [y/N]: \c"
|
echo -e "\nDo you want to remove your music storage directory ${STOR_DIR} and all of its subdirectories? [y/N]: \c"
|
||||||
read IN
|
read IN
|
||||||
if [[ ( "$IN" = "y" || "$IN" = "Y" ) ]]; then
|
if [[ ("$IN" = "y" || "$IN" = "Y") ]]; then
|
||||||
rm -rf "${STOR_DIR}"
|
rm -rf "${STOR_DIR}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "\nNo stor directory found, skipping..."
|
echo -e "\nNo stor directory found, skipping..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\nUninstalling LibreTime..."
|
echo -e "\nUninstalling LibreTime..."
|
||||||
|
@ -94,14 +87,14 @@ removeRabbitmqLibreTimeSettings
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
for i in ${FILES[*]}; do
|
for i in ${FILES[*]}; do
|
||||||
rm -rf $i
|
rm -rf $i
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "\nDo you want to drop your current LibreTime database? [y/N]: \c"
|
echo -e "\nDo you want to drop your current LibreTime database? [y/N]: \c"
|
||||||
read IN
|
read IN
|
||||||
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
|
if [[ "$IN" = "y" || "$IN" = "Y" ]]; then
|
||||||
echo -e "\nDropping LibreTime database..."
|
echo -e "\nDropping LibreTime database..."
|
||||||
dropLibreTimeDatabase
|
dropLibreTimeDatabase
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pip3 uninstall -y airtime-playout airtime-media-monitor airtime-analyzer
|
pip3 uninstall -y airtime-playout airtime-media-monitor airtime-analyzer
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Absolute path to this script
|
# Absolute path to this script
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=$(readlink -f $0)
|
||||||
# Absolute directory this script is in
|
# Absolute directory this script is in
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
SCRIPTPATH=$(dirname $SCRIPT)
|
||||||
|
|
||||||
php -q $SCRIPTPATH/airtime-log.php "$@" || exit 1
|
php -q $SCRIPTPATH/airtime-log.php "$@" || exit 1
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
# This script send data to data collection server
|
# This script send data to data collection server
|
||||||
#
|
#
|
||||||
# Absolute path to this script
|
# Absolute path to this script
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=$(readlink -f $0)
|
||||||
# Absolute directory this script is in
|
# Absolute directory this script is in
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
SCRIPTPATH=$(dirname $SCRIPT)
|
||||||
|
|
||||||
cd $SCRIPTPATH
|
cd $SCRIPTPATH
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
# This script send data to data collection server
|
# This script send data to data collection server
|
||||||
#
|
#
|
||||||
# Absolute path to this script
|
# Absolute path to this script
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=$(readlink -f $0)
|
||||||
# Absolute directory this script is in
|
# Absolute directory this script is in
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
SCRIPTPATH=$(dirname $SCRIPT)
|
||||||
|
|
||||||
cd $SCRIPTPATH
|
cd $SCRIPTPATH
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]; then
|
||||||
then
|
## Use config
|
||||||
## Use config
|
backup_folder=~/libretime_backup/
|
||||||
backup_folder=~/libretime_backup/
|
else
|
||||||
else
|
## User arg as config
|
||||||
## User arg as config
|
backup_folder=$1
|
||||||
backup_folder=$1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
airtime_conf_path=/etc/airtime/airtime.conf
|
airtime_conf_path=/etc/airtime/airtime.conf
|
||||||
uploads_folder=/srv/airtime/stor/
|
uploads_folder=/srv/airtime/stor/
|
||||||
|
|
||||||
psdl_db=$(grep dbname ${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_user=$(grep dbuser ${airtime_conf_path} | awk '{print $3;}')
|
||||||
psql_password=$(grep dbpass ${airtime_conf_path} | awk '{print $3;}' )
|
psql_password=$(grep dbpass ${airtime_conf_path} | awk '{print $3;}')
|
||||||
|
|
||||||
## Remove old backup
|
## Remove old backup
|
||||||
rm -rf $backup_folder
|
rm -rf $backup_folder
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
pid_found="$?"
|
pid_found="$?"
|
||||||
|
|
||||||
if [ "$pid_found" == "0" ]; then
|
if [ "$pid_found" == "0" ]; then
|
||||||
#PID is available in the status message
|
#PID is available in the status message
|
||||||
rabbitmqpid=`/etc/init.d/rabbitmq-server status | grep "\[{pid" | sed "s/.*,\(.*\)\}.*/\1/"`
|
rabbitmqpid=$(/etc/init.d/rabbitmq-server status | grep "\[{pid" | sed "s/.*,\(.*\)\}.*/\1/")
|
||||||
else
|
else
|
||||||
#PID should be available from file
|
#PID should be available from file
|
||||||
rabbitmqpid=`sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids`
|
rabbitmqpid=$(sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "RabbitMQ PID: $rabbitmqpid"
|
echo "RabbitMQ PID: $rabbitmqpid"
|
||||||
|
|
|
@ -7,10 +7,9 @@
|
||||||
# 1 - Rivendell store files in .wav format, airtime uses .mp3 format
|
# 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.
|
# 2 - WAV does not have Meta-tag support so all meta-tags need to be fetched from Rivendell database.
|
||||||
|
|
||||||
|
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "usage: $0 <rivendell_dir> <final_dir>"
|
echo "usage: $0 <rivendell_dir> <final_dir>"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#*** MySql data ***#
|
#*** MySql data ***#
|
||||||
|
@ -24,23 +23,21 @@ end_dir=$2
|
||||||
|
|
||||||
cd "$rivendell_dir"
|
cd "$rivendell_dir"
|
||||||
|
|
||||||
for file in *
|
for file in *; do
|
||||||
do
|
lame "$file"
|
||||||
lame "$file"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
mv "$rivendell_dir"/*.mp3 "$end_dir"
|
mv "$rivendell_dir"/*.mp3 "$end_dir"
|
||||||
cd "$end_dir"
|
cd "$end_dir"
|
||||||
|
|
||||||
for file in *
|
for file in *; do
|
||||||
do
|
id=$(echo $file | head -c 10)
|
||||||
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)
|
||||||
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)
|
||||||
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)
|
||||||
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)
|
||||||
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
|
||||||
id3 -t "$title" -a "$artist" -A "$album" -y "$year" $file
|
mv "$file" "$artist-$title.mp3"
|
||||||
mv "$file" "$artist-$title.mp3"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Reference in New Issue