Linux定時腳本

切換到相應目錄

cd /home/pgbackups/

創建腳本文件

touch pgbackups.sh

編輯自動化腳本

#! /bin/bash
/home/postgres/pgsql/bin/pg_dump -h 10.8.87.7 -p 5478 -U postgres --column-inserts wechart > /home/pgbackups/wechartdb`date +%Y%m%d`.sql

打開自動化腳本編輯

crontab -e

編輯自動運行(每天5點半執行)

30 5 * * * /home/data/pgbackups.sh > /home/data/logs 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章