Skip to content

Instantly share code, notes, and snippets.

@Rtoax
Last active July 8, 2022 03:48
Show Gist options
  • Save Rtoax/ffd75056a17b88ed039ef0e02b953587 to your computer and use it in GitHub Desktop.
Save Rtoax/ffd75056a17b88ed039ef0e02b953587 to your computer and use it in GitHub Desktop.
DNF repo sync script
#!/bin/bash
REPOSYNC_SCRIPTS_LIST=$(find -name reposync.sh)
for script in $REPOSYNC_SCRIPTS_LIST
do
cd $(dirname $script)
sh $(basename $script)
cd -
done
echo "Sync repo in $(date)" >> reposync.log
[Unit]
Description=Reposync
[Service]
PIDFile=/run/trigger-master.pid
ExecStart=/home/rongtao/repos/reposync-all.sh
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
#!/bin/bash
# 同步所有 repo
root_dir=$(dirname `realpath $0`)
cur_dir=$(pwd)
cd $root_dir
scripts=$(find -name allreposync.sh)
for s in $scripts
do
cd $(dirname $s)
sh $(basename $s)
cd -
done
cd $cur_dir
echo "Sync repo in $(date)" >> /tmp/reposync.log
[Unit]
Description=Repo sync
[Timer]
#OnUnitActiveSec=*-*-* 01:00:00
OnCalendar=*-*-* 01:00:00
Unit=reposync-all.service
[Install]
WantedBy=multi-user.target
#!/bin/bash
dnf --repoid=os \
--repofrompath=os,https://mirrors.bfsu.edu.cn/centos-stream/9-stream/BaseOS/x86_64/os/ \
--download-metadata \
--remote-time \
reposync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment