#!/bin/bash virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" . ${virtualenv_bin}activate pypo_user="pypo" # Location of pypo_cli.py Python script pypo_path="/usr/lib/airtime/pypo/bin/" api_client_path="/usr/lib/airtime/" pypo_script="pypocli.py" cd ${pypo_path} exec 2>&1 set +e cat /etc/default/locale | grep -i "LANG=.*UTF-\?8" set -e if [ "$?" != "0" ]; then echo "non UTF-8 default locale found in /etc/default/locale." > /var/log/airtime/pypo/error.log exit 1 fi export HOME="/var/tmp/airtime/pypo/" export PYTHONPATH=${api_client_path}:$PYTHONPATH export LC_ALL=`cat /etc/default/locale | grep "LANG=" | cut -d= -f2 | tr -d "\n\""` export TERM=xterm #If Pypo is starting from scratch let's restart Liquidsoap as well. This is so #that the Liquidsoap queue #is emptied and we can start from a known state. /etc/init.d/airtime-liquidsoap status status="$?" if [ "$status" == "0" ]; then /etc/init.d/airtime-liquidsoap restart else /etc/init.d/airtime-liquidsoap start fi exec python ${pypo_path}${pypo_script} > /var/log/airtime/pypo/py-interpreter.log 2>&1 # EOF