cc-2055: switch to init-d
-fix daemon being able to start multiple times -make airtime-install shell script to call installers seperately -
This commit is contained in:
parent
5803635d50
commit
c05c2f1e28
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
php airtime-install.php $@ || exit $?
|
||||||
|
|
||||||
|
echo "*** Pypo Installation ***"
|
||||||
|
#python ".__DIR__."/../python_apps/pypo/install/pypo-install.py || exit $?
|
||||||
|
python ../python_apps/pypo/install/pypo-install.py || exit $?
|
||||||
|
|
||||||
|
echo "*** Recorder Installation ***"
|
||||||
|
#python ".__DIR__."/../python_apps/show-recorder/install/recorder-install.py || exit $?
|
||||||
|
#python ../python_apps/show-recorder/install/recorder-install.py || exit $?
|
||||||
|
|
||||||
|
airtime-check-system
|
|
@ -43,20 +43,20 @@ catch (Zend_Console_Getopt_Exception $e) {
|
||||||
|
|
||||||
if (isset($opts->h)) {
|
if (isset($opts->h)) {
|
||||||
echo $opts->getUsageMessage();
|
echo $opts->getUsageMessage();
|
||||||
exit;
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The current version is already installed.
|
// The current version is already installed.
|
||||||
if(isset($version) && ($version != false) && ($version == AIRTIME_VERSION) && !isset($opts->r)) {
|
if(isset($version) && ($version != false) && ($version == AIRTIME_VERSION) && !isset($opts->r)) {
|
||||||
echo "Airtime $version is already installed.".PHP_EOL;
|
echo "Airtime $version is already installed.".PHP_EOL;
|
||||||
echo $opts->getUsageMessage();
|
echo $opts->getUsageMessage();
|
||||||
exit();
|
exit(1);
|
||||||
}
|
}
|
||||||
// A previous version exists - if so, upgrade.
|
// A previous version exists - if so, upgrade.
|
||||||
if(isset($version) && ($version != false) && ($version < AIRTIME_VERSION)) {
|
if(isset($version) && ($version != false) && ($version < AIRTIME_VERSION)) {
|
||||||
echo "Airtime version $version found.".PHP_EOL;
|
echo "Airtime version $version found.".PHP_EOL;
|
||||||
require_once("airtime-upgrade.php");
|
require_once("airtime-upgrade.php");
|
||||||
exit();
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
@ -126,19 +126,19 @@ AirtimeInstall::CreateSymlinksToUtils();
|
||||||
|
|
||||||
AirtimeInstall::CreateZendPhpLogFile();
|
AirtimeInstall::CreateZendPhpLogFile();
|
||||||
|
|
||||||
echo PHP_EOL."*** Pypo Installation ***".PHP_EOL;
|
#echo PHP_EOL."*** Pypo Installation ***".PHP_EOL;
|
||||||
system("python ".__DIR__."/../python_apps/pypo/install/pypo-install.py");
|
#system("python ".__DIR__."/../python_apps/pypo/install/pypo-install.py");
|
||||||
|
|
||||||
echo PHP_EOL."*** Recorder Installation ***".PHP_EOL;
|
#echo PHP_EOL."*** Recorder Installation ***".PHP_EOL;
|
||||||
system("python ".__DIR__."/../python_apps/show-recorder/install/recorder-install.py");
|
#system("python ".__DIR__."/../python_apps/show-recorder/install/recorder-install.py");
|
||||||
|
|
||||||
//wait for 1.9.0 release
|
//wait for 1.9.0 release
|
||||||
//echo PHP_EOL."*** Media Monitor Installation ***".PHP_EOL;
|
//echo PHP_EOL."*** Media Monitor Installation ***".PHP_EOL;
|
||||||
//system("python ".__DIR__."/../python_apps/pytag-fs/install/media-monitor-install.py");
|
//system("python ".__DIR__."/../python_apps/pytag-fs/install/media-monitor-install.py");
|
||||||
|
|
||||||
echo PHP_EOL."*** Verifying Correct System Environment ***".PHP_EOL;
|
#echo PHP_EOL."*** Verifying Correct System Environment ***".PHP_EOL;
|
||||||
$command = "airtime-check-system";
|
#$command = "airtime-check-system";
|
||||||
system($command);
|
#system($command);
|
||||||
|
|
||||||
echo "******************************* Install Complete *******************************".PHP_EOL;
|
echo "******************************* Install Complete *******************************".PHP_EOL;
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
|
|
||||||
USERID=pypo
|
USERID=pypo
|
||||||
GROUPID=pypo
|
GROUPID=pypo
|
||||||
ENABLE="false"
|
|
||||||
NAME=Airtime
|
NAME=Airtime
|
||||||
ID=airtime
|
|
||||||
|
|
||||||
DAEMON=/usr/bin/airtime-pypo
|
DAEMON=/usr/bin/airtime-pypo
|
||||||
PIDFILE=/var/run/$ID.pid
|
PIDFILE=/var/run/airtime.pid
|
||||||
|
|
||||||
start () {
|
start () {
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||||
|
@ -16,7 +14,7 @@ start () {
|
||||||
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 $PIDFILE
|
rm -f $PIDFILE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -174,12 +174,10 @@ try:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print "Waiting for processes to start..."
|
print "Waiting for processes to start..."
|
||||||
os.system("service airtime-pypo start")
|
|
||||||
Popen("service airtime-pypo start".split(" "))
|
|
||||||
|
|
||||||
print "sleeping"
|
|
||||||
time.sleep(10)
|
|
||||||
|
|
||||||
|
p = Popen("/etc/init.d/airtime-pypo start", shell=True)
|
||||||
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "exception:" + str(e)
|
print "exception:" + str(e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -109,6 +109,12 @@ if __name__ == '__main__':
|
||||||
print '###########################################'
|
print '###########################################'
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, keyboardInterruptHandler)
|
signal.signal(signal.SIGINT, keyboardInterruptHandler)
|
||||||
|
|
||||||
|
#import daemonize
|
||||||
|
#daemonize.createDaemon()
|
||||||
|
#open("airtime.pid", "w").write(str(os.getpid()) + "\n")
|
||||||
|
#daemonize.drop_privileges("pypo", "pypo")
|
||||||
|
|
||||||
|
|
||||||
# initialize
|
# initialize
|
||||||
g = Global()
|
g = Global()
|
||||||
|
@ -127,11 +133,9 @@ if __name__ == '__main__':
|
||||||
q = Queue()
|
q = Queue()
|
||||||
|
|
||||||
pp = PypoPush(q)
|
pp = PypoPush(q)
|
||||||
pp.daemon = True
|
|
||||||
pp.start()
|
pp.start()
|
||||||
|
|
||||||
pf = PypoFetch(q)
|
pf = PypoFetch(q)
|
||||||
pf.daemon = True
|
|
||||||
pf.start()
|
pf.start()
|
||||||
|
|
||||||
while True: time.sleep(3600)
|
while True: time.sleep(3600)
|
||||||
|
|
Loading…
Reference in New Issue