Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import schedule
- @with_logging
- def run_shell_script(command, extra_params=None):
- # dir_path = os.path.dirname(sys.argv[0])
- os.system("sh %s" % command)
- def run_threaded(command):
- job_thread = threading.Thread(target=run_shell_script, args=(command, ))
- job_thread.start()
- def schedule_jobs():
- # Clenup InActive jobs from the system
- schedule.every().day.at("03:00").do(run_threaded, script_paths.get('cleanup'))
- # Map JobTitles to Burning Glass std. titles
- schedule.every().day.at("04:00").do(run_threaded, script_paths.get('map_std_titles'))
- schedule.every().day.at("12:00").do(run_threaded, script_paths.get('map_std_titles'))
- schedule.every().day.at("20:00").do(run_threaded, script_paths.get('map_std_titles'))
- # Copy job documents to JobsModel Collection
- schedule.every().day.at("05:30").do(run_threaded, script_paths.get('copy_documents'))
- schedule.every().day.at("11:30").do(run_threaded, script_paths.get('copy_documents'))
- schedule.every().day.at("17:30").do(run_threaded, script_paths.get('copy_documents'))
- schedule.every().day.at("23:30").do(run_threaded, script_paths.get('copy_documents'))
- if __name__ == '__main__':
- logger = get_basic_logger()
- schedule_jobs()
- while True:
- schedule.run_pending()
- time.sleep(1)
- 30 23,5,11,17 * * * bash /home/data/my-codebase/copy_document.sh
Add Comment
Please, Sign In to add comment