cron job for backup the database in linux/php

后端 未结 5 1683
独厮守ぢ
独厮守ぢ 2021-02-10 22:02

Am new to linux cron job, i am using mysql DB, my database name finaldb, i want to take this database every one hour,

I have folder called dailbackup, in this i have fol

5条回答
  •  庸人自扰
    2021-02-10 22:36

    crontab -e
    

    putting this:

    the_date='date +%Y%m%d'
    the_hour='date +%H'
    0 * * * * mysqldump OPTIONS > /dailbackup/`$the_date`/final_db_`$the_hour`.sql
    

    the above cron is allow you to backup database every hour and using the %H as sql file name

提交回复
热议问题