Skip to content

Instantly share code, notes, and snippets.

@smbambling
Created September 29, 2016 16:53
Show Gist options
  • Save smbambling/28b3425f263b564ace3736e88a4921e8 to your computer and use it in GitHub Desktop.
Save smbambling/28b3425f263b564ace3736e88a4921e8 to your computer and use it in GitHub Desktop.
#!/bin/sh
# This file is managed by Puppet.
# Any changes will be lost.
# This is the rsync script to manage <%= @repository %>
# Logging
DATE=`/bin/date +%Y-%m-%d`
CONFFILE='/etc/yum.repos.d/<%= @repository -%>.repo'
OUTDIR='<%= @log_directory %>'
[ -d $OUTDIR ] || mkdir -p $OUTDIR
OUTFILE=$OUTDIR/<%= @repository %>-mirror-$DATE.txt
/bin/nice /usr/bin/reposync --norepopath -r <%= @repository %> -p <%= @docroot %><%= @repository %>/RPMS -d -c ${CONFFILE} >> $OUTFILE 2>&1
RC=$?
# Run createrepo to create/update the yum metadata
if [ ${RC} = 0 ]; then
/usr/bin/createrepo <%= @docroot %><%= @repository %> >> $OUTFILE 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment