daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Jul 22nd, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. import schedule
  3.  
  4. @with_logging
  5. def run_shell_script(command, extra_params=None):
  6.     # dir_path = os.path.dirname(sys.argv[0])
  7.     os.system("sh %s" % command)
  8.  
  9. def run_threaded(command):
  10.     job_thread = threading.Thread(target=run_shell_script, args=(command, ))
  11.     job_thread.start()
  12.  
  13. def schedule_jobs():
  14.     # Clenup InActive jobs from the system
  15.     schedule.every().day.at("03:00").do(run_threaded, script_paths.get('cleanup'))
  16.  
  17.     # Map JobTitles to Burning Glass std. titles
  18.     schedule.every().day.at("04:00").do(run_threaded, script_paths.get('map_std_titles'))
  19.     schedule.every().day.at("12:00").do(run_threaded, script_paths.get('map_std_titles'))
  20.     schedule.every().day.at("20:00").do(run_threaded, script_paths.get('map_std_titles'))
  21.  
  22.     # Copy job documents to JobsModel Collection
  23.     schedule.every().day.at("05:30").do(run_threaded, script_paths.get('copy_documents'))
  24.     schedule.every().day.at("11:30").do(run_threaded, script_paths.get('copy_documents'))
  25.     schedule.every().day.at("17:30").do(run_threaded, script_paths.get('copy_documents'))
  26.     schedule.every().day.at("23:30").do(run_threaded, script_paths.get('copy_documents'))
  27.  
  28. if __name__ == '__main__':
  29.     logger = get_basic_logger()
  30.     schedule_jobs()
  31.     while True:
  32.         schedule.run_pending()
  33.         time.sleep(1)
  34.    
  35. 30 23,5,11,17 * * * bash /home/data/my-codebase/copy_document.sh
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top