cron job for backup the database in linux/php

后端 未结 5 1797
不知归路
不知归路 2021-02-10 21:58

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:50

    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

提交回复
热议问题