Exemplo n.º 1
0
    def TestGetEumetcastDaemon(self):

        logger.info('Test GetEumetcast daemon')

        pid_file = es_constants.get_eumetcast_pid_filename
        daemon = acquisition.GetEumetcastDaemon(pid_file, dry_run=True)

        # If the daemon is running, stop it and check file does not exist
        if os.path.isfile(pid_file):
            logger.info('GetEumetcast pid file exist: stop daemon')
            try:
                daemon.stop()
            except:
                pass
            self.assertEqual(os.path.isfile(pid_file), 0)
        else:
            logger.info('GetEumetcast pid file des NOT exist: start daemon')
            try:
                daemon.start()
            except:
                pass
            time.sleep(1)
            self.assertEqual(os.path.isfile(pid_file), 1)
Exemplo n.º 2
0
_author__ = "Marco Clerici"

import sys

from config import es_constants
from apps.acquisition import acquisition
from lib.python import es_logging as log
logger = log.my_logger("apps.acquisition.get_eumetcast")

try:
    command = str(sys.argv[1])
except:
    logger.fatal("An argument should be provided: status/start/stop")
    exit(1)

# Define pid file and create daemon
pid_file = es_constants.get_eumetcast_pid_filename
daemon = acquisition.GetEumetcastDaemon(pid_file, dry_run=False)

if command == "status":
    status = daemon.status()
    print("Current status of the Service: %s" % status)

if command == "start":
    logger.info("Starting Get EUMETCast service")
    daemon.start()

if command == "stop":
    logger.info("Stopping Get EUMETCast service")
    daemon.stop()