Score:0

rsync delete my relases files

cn flag

I'm mirror of ubuntu, releases and deb files. When I run the following script by hand, I get every releases files. But when I run it via crontab, releases directory will be deleted.

#/bin/dash                                                                                                                                                                                          
                                                                                                                                                                                                
fatal() {                                                                                                                                                                                           
  echo "$1"                                                                                                                                                                                         
  exit 1                                                                                                                                                                                            
}                                                                                                                                                                                                   
                                                                                                                                                                                                    
warn() {                                                                                                                                                                                            
  echo "$1"                                                                                                                                                                                         
}                                                                                                                                                                                                   
                                                                                                                                                                                                   
RSYNCSOURCE=rsync://archive.ubuntu.com/releases                                                                                                                                                     
                                                                                                                                                                                            

BASEDIR=/home/ubuntu/releases                                                                                                                                                                       
                                                                                                                                                                                                    
if [ ! -d ${BASEDIR} ]; then                                                                                                                                                                        
  warn "${BASEDIR} does not exist yet, trying to create it..."                                                                                                                                      
  mkdir -p ${BASEDIR} || fatal "Creation of ${BASEDIR} failed."                                                                                                                                     
fi                                                                                                                                                                                                  
                                                                                                                                                                                                    
rsync --verbose --recursive --times --links --safe-links --hard-links \                                                                                                                             
  --stats \                                                                                                                                                                                         
  ${RSYNCSOURCE} ${BASEDIR} || fatal "Failed to rsync from ${RSYNCSOURCE}."                                                                                                                         
                                                                                                                                                                                                   
date -u > ${BASEDIR}/.trace/$(hostname -f)                                                                                                                                                          
                                                                                                                                                                                                    
chown 977:977 /home/ubuntu/* -R                                  

Recommended of ubuntu is here
A point is a when cron run my script at first delete my releases dir.
How can I sync releases with main ubuntu with deleting my files?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.