def check_own_version(log):
    if not DEV_MODE:
        own_dir = get_own_dir(__file__)
        version_path = os.path.join(own_dir, 'VERSION')
        restart_script_path = os.path.join(own_dir, 'restart_meocloud.sh')
        try:
            while True:
                gevent.sleep(DAEMON_VERSION_CHECKER_PERIOD)
                with open(version_path) as f:
                    current_version = f.read().strip()
                if current_version != VERSION:
                    log.info('There seems to have been an update and nobody told us. Will now restart!')
                    Popen(restart_script_path, close_fds=True)
                    gevent.sleep(10)
                    log.error('We should have been restarted, why are we still here?!')
                    Events.shutdown_required.set()
        except IOError:
            log.exception('check_own_version error')
dataset/ETHPy150Open alticelabs/meocloud-cli/meocloud/client/linux/daemon/daemon.py/check_own_version/original