Skip to content

Instantly share code, notes, and snippets.

@nithyadurai87
Last active November 23, 2020 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nithyadurai87/af1d2e82148bb56041d80e2495080bc7 to your computer and use it in GitHub Desktop.
Save nithyadurai87/af1d2e82148bb56041d80e2495080bc7 to your computer and use it in GitHub Desktop.
from datetime import datetime
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
dag = DAG('bash_exp', description='Mysql backup every hour', schedule_interval='00 * * * *', start_date=datetime(2020, 11, 2), catchup=False)
operator = BashOperator(task_id='backup_task', bash_command='mysqldump -u root -ppassword sample > "/home/shrini/backups/"sample_"$(date +"%Y%m%d_%H%M%S").sql"',dag=dag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment