設定定時器自動更新yum源

2021-09-29 11:50:26 字數 885 閱讀 1857

#!/bin/bash

datetime=`date + "%y-%m-%d"`

exec > /var/log/centosrepo.log

reposync -d -r base -p /opt/yum/centos/6/os/x86_64/

reposync -d -r updates -p /opt/yum/centos/6/os/x86_64/

reposync -d -r extras -p /opt/yum/centos/6/os/x86_64/

reposync -d -r centosplus -p /opt/yum/centos/6/os/x86_64/

reposync -d -r contrib -p /opt/yum/centos/6/os/x86_64/

if [ $? -eq 0 ];then

createrepo --update /opt/yum/centos/6/os/x86_64/

echo "success:$datetime epel update successful"

else

echo "error:$datetime epel update failed"

fi

這個指令碼是更新所有的yum包,包括base/updates/extras/centosplus/contrib

需要說明的是,自己的centos上一定要安裝epel,這也是乙個庫,這個庫裡面有很多yum源上面沒有的rpm的包

之後使用root使用者去設定crond程序,定時同步。

0 14 * * 0 /bin/bash /root/yum-update.sh

Mysql 檢視定時器 開啟定時器 設定定時器時間

1.檢視是否開啟evevt與開啟evevt。1.1 mysql evevt功能預設是關閉的,可以使用下面的語句來看evevt的狀態,如果是off或者0,表示是關閉的。show variables like sche 1.2 開啟evevt功能 setglobal event scheduler 1 ...

Mysql 檢視定時器 開啟定時器 設定定時器時間

1 1.檢視是否開啟evevt與開啟evevt。23 1.1 mysql evevt功能預設是關閉的,可以使用下面的語句來看evevt的狀態,如果是off或者0,表示是關閉的。4 show variables like sche 5 1.2 開啟evevt功能 6 set global event ...

Html自動更新以及設定快取

出自 前端設定http快取,前端設定html頁面快取方法 靜態的html頁面想要設定使用快取需要通過http的meta設定expires和cache control 設定如下網頁元資訊 解答 cache control no cache no store max age 1.no cache 表面意...