Merge branch 'airtime-2.0.x' of dev.sourcefabric.org:airtime into airtime-2.0.x
This commit is contained in:
commit
9216da7f03
|
@ -8,7 +8,9 @@
|
|||
* that the user can customize these.
|
||||
*/
|
||||
|
||||
$ini = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||
|
||||
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||
$ini = parse_ini_file($configFile, true);
|
||||
|
||||
$dbhost = $ini['database']['host'];
|
||||
$dbname = $ini['database']['dbname'];
|
||||
|
|
|
@ -23,7 +23,9 @@ $CC_CONFIG = array(
|
|||
'phingPath' => dirname(__FILE__).'/../../library/phing'
|
||||
);
|
||||
|
||||
Config::loadConfig("/etc/airtime/airtime.conf");
|
||||
|
||||
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||
Config::loadConfig($configFile);
|
||||
|
||||
// Add database table names
|
||||
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';
|
||||
|
|
|
@ -7,7 +7,9 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
|
|||
if (Application_Model_RabbitMq::$doPush) {
|
||||
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
|
||||
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
|
||||
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
|
||||
if (!isset($_SERVER['AIRTIME_SRV'])){
|
||||
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -409,11 +409,13 @@ class Application_Model_StoredFile {
|
|||
* @return string
|
||||
*/
|
||||
public function getFilePath()
|
||||
{
|
||||
{
|
||||
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
||||
$directory = $music_dir->getDirectory();
|
||||
|
||||
$filepath = $this->_file->getDbFilepath();
|
||||
|
||||
return $music_dir->getDirectory().$filepath;
|
||||
return $directory.$filepath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -877,8 +879,13 @@ class Application_Model_StoredFile {
|
|||
|
||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
$r = @copy($audio_file, $audio_stor);
|
||||
$r = @unlink($audio_file);
|
||||
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||
|
||||
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||
$r = @rename($audio_file, $audio_stor);
|
||||
|
||||
//$r = @copy($audio_file, $audio_stor);
|
||||
//$r = @unlink($audio_file);
|
||||
}
|
||||
|
||||
public static function getFileCount()
|
||||
|
|
|
@ -17,16 +17,17 @@ fi
|
|||
|
||||
showhelp () {
|
||||
echo "Usage: airtime-install [options]
|
||||
--help|-h Displays usage information.
|
||||
--overwrite|-o Overwrite any existing config files.
|
||||
--preserve|-p Keep any existing config files.
|
||||
--no-db|-n Turn off database install.
|
||||
--reinstall|-r Force a fresh install of this Airtime Version
|
||||
--media-monitor|-m Install only media-monitor
|
||||
--pypo|-p Install only pypo and liquidsoap
|
||||
--show-recorder|-s Install only show-recorder
|
||||
--web|-w Install only files for web-server
|
||||
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading"
|
||||
--help|-h Displays usage information.
|
||||
--overwrite|-o Overwrite any existing config files.
|
||||
--preserve|-p Keep any existing config files.
|
||||
--no-db|-n Turn off database install.
|
||||
--reinstall|-r Force a fresh install of this Airtime Version
|
||||
--media-monitor|-m Install only media-monitor
|
||||
--pypo|-p Install only pypo and liquidsoap
|
||||
--show-recorder|-s Install only show-recorder
|
||||
--web|-w Install only files for web-server
|
||||
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading
|
||||
--disable-auto-start-services|-d Disable auto-starting Airtime services"
|
||||
}
|
||||
|
||||
overwrite="f"
|
||||
|
@ -38,8 +39,9 @@ pypo="f"
|
|||
showrecorder="f"
|
||||
web="f"
|
||||
liquidsoap_keep_alive="f"
|
||||
disable_auto_start_services="f"
|
||||
|
||||
set -- $(getopt -l help,overwrite,preserve,no-db,reinstall,media-monitor,pypo,show-recorder,web,liquidsoap-keep-alive "hopnrmyswl" "$@")
|
||||
set -- $(getopt -l help,overwrite,preserve,no-db,reinstall,media-monitor,pypo,show-recorder,web,liquidsoap-keep-alive,disable-auto-start-services "hopnrmyswld" "$@")
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
|
@ -53,6 +55,7 @@ do
|
|||
(-s|--show-recorder) showrecorder="t";;
|
||||
(-w|--web) web="t";;
|
||||
(-l|--liquidsoap-keep-alive) liquidsoap_keep_alive="t";;
|
||||
(-d|--disable-auto-start-services) disable_auto_start_services="t";;
|
||||
|
||||
(--) shift; break;;
|
||||
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
|
||||
|
@ -107,6 +110,7 @@ export nodb
|
|||
export overwrite
|
||||
export preserve
|
||||
export liquidsoap_keep_alive
|
||||
export disable_auto_start_services
|
||||
|
||||
set +e
|
||||
test "$mediamonitor" = "t" -o "$pypo" = "t" -o "$showrecorder" = "t"
|
||||
|
|
|
@ -53,15 +53,17 @@ sleep 1
|
|||
|
||||
set +e
|
||||
|
||||
if [ "$mediamonitor" = "t" ]; then
|
||||
monit monitor airtime-media-monitor
|
||||
fi
|
||||
if [ "$pypo" = "t" ]; then
|
||||
monit monitor airtime-playout
|
||||
monit monitor airtime-liquidsoap
|
||||
fi
|
||||
if [ "$showrecorder" = "t" ]; then
|
||||
monit monitor airtime-show-recorder
|
||||
if [ "$disable_auto_start_services" = "f" ]; then
|
||||
if [ "$mediamonitor" = "t" ]; then
|
||||
monit monitor airtime-media-monitor
|
||||
fi
|
||||
if [ "$pypo" = "t" ]; then
|
||||
monit monitor airtime-playout
|
||||
monit monitor airtime-liquidsoap
|
||||
fi
|
||||
if [ "$showrecorder" = "t" ]; then
|
||||
monit monitor airtime-show-recorder
|
||||
fi
|
||||
fi
|
||||
|
||||
monit monitor rabbitmq-server
|
||||
|
|
|
@ -42,8 +42,9 @@ try:
|
|||
sys.exit(1)
|
||||
|
||||
#copy monit files
|
||||
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
if os.environ["disable_auto_start_services"] == "f":
|
||||
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
|
||||
#create log dir
|
||||
create_dir(config['log_dir'])
|
||||
|
|
|
@ -6,15 +6,17 @@ if os.geteuid() != 0:
|
|||
sys.exit(1)
|
||||
|
||||
try:
|
||||
#update-rc.d init script
|
||||
p = Popen("update-rc.d airtime-media-monitor defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
if os.environ["disable_auto_start_services"] == "f":
|
||||
#update-rc.d init script
|
||||
p = Popen("update-rc.d airtime-media-monitor defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
#Start media-monitor daemon
|
||||
print "* Waiting for media-monitor processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
#Start media-monitor daemon
|
||||
print "* Waiting for media-monitor processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
except Exception, e:
|
||||
print e
|
||||
|
|
|
@ -3,8 +3,3 @@
|
|||
|
||||
set httpd port 2812
|
||||
allow admin:monit
|
||||
|
||||
check process rabbitmq-server
|
||||
with pidfile "/var/run/rabbitmq.pid"
|
||||
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; /usr/lib/airtime/utils/rabbitmq-update-pid.sh'"
|
||||
stop program = "/etc/init.d/rabbitmq-server stop"
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
set daemon 10 # Poll at 5 second intervals
|
||||
#set logfile syslog facility log_daemon
|
||||
set logfile /var/log/monit.log
|
||||
|
||||
set httpd port 2812
|
||||
allow admin:monit
|
||||
|
||||
check process rabbitmq-server
|
||||
with pidfile "/var/run/rabbitmq.pid"
|
||||
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'"
|
||||
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; /usr/lib/airtime/utils/rabbitmq-update-pid.sh'"
|
||||
stop program = "/etc/init.d/rabbitmq-server stop"
|
||||
|
|
|
@ -42,9 +42,11 @@ try:
|
|||
sys.exit(1)
|
||||
|
||||
#copy monit files
|
||||
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
shutil.copy('%s/../../monit/monit-airtime-rabbitmq-server.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
if os.environ["disable_auto_start_services"] == "f":
|
||||
shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
|
||||
#create pypo log dir
|
||||
create_dir(config['pypo_log_dir'])
|
||||
|
|
|
@ -87,10 +87,6 @@ try:
|
|||
print "Unsupported system architecture."
|
||||
sys.exit(1)
|
||||
|
||||
#initialize init.d scripts
|
||||
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
#generate liquidsoap config file
|
||||
#access the DB and generate liquidsoap.cfg under /etc/airtime/
|
||||
ac = api_client.api_client_factory(config)
|
||||
|
@ -101,18 +97,23 @@ try:
|
|||
else:
|
||||
print "Unable to connect to the Airtime server."
|
||||
|
||||
#restart airtime-playout
|
||||
print "* Waiting for pypo processes to start..."
|
||||
if os.environ["liquidsoap_keep_alive"] == "f":
|
||||
print " * Restarting any previous Liquidsoap instances"
|
||||
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
||||
if os.environ["disable_auto_start_services"] == "f":
|
||||
#initialize init.d scripts
|
||||
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
else:
|
||||
print " * Keeping any previous Liquidsoap instances running"
|
||||
p = Popen("/etc/init.d/airtime-playout pypo-stop", shell=True)
|
||||
|
||||
#restart airtime-playout
|
||||
print "* Waiting for pypo processes to start..."
|
||||
if os.environ["liquidsoap_keep_alive"] == "f":
|
||||
print " * Restarting any previous Liquidsoap instances"
|
||||
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
else:
|
||||
print " * Keeping any previous Liquidsoap instances running"
|
||||
p = Popen("/etc/init.d/airtime-playout pypo-stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
except Exception, e:
|
||||
print e
|
||||
|
|
|
@ -41,10 +41,11 @@ try:
|
|||
print 'Error loading config file: ', e
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
||||
#copy monit files
|
||||
shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
if os.environ["disable_auto_start_services"] == "f":
|
||||
shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
|
||||
#create temporary media-storage directory
|
||||
#print "Creating temporary media storage directory"
|
||||
|
|
|
@ -7,15 +7,16 @@ if os.geteuid() != 0:
|
|||
sys.exit(1)
|
||||
|
||||
try:
|
||||
#register init.d script
|
||||
p = Popen("update-rc.d airtime-show-recorder defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
#start daemon
|
||||
print "* Waiting for show-recorder processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
if os.environ["disable_auto_start_services"] == "f":
|
||||
#register init.d script
|
||||
p = Popen("update-rc.d airtime-show-recorder defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
#start daemon
|
||||
print "* Waiting for show-recorder processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
except Exception, e:
|
||||
print e
|
||||
|
|
Loading…
Reference in New Issue