Compare commits
4 Commits
725d90d621
...
3d979440b8
Author | SHA1 | Date |
---|---|---|
Max Erenberg | 3d979440b8 | |
Max Erenberg | 2f7fd80f8e | |
Max Erenberg | 2a4ff5ef8e | |
Max Erenberg | 2b4cd0b819 |
|
@ -3,7 +3,9 @@
|
|||
|
||||
MIRRORNAME=mirror.csclub.uwaterloo.ca
|
||||
TO="/mirror/root/debian-security"
|
||||
MAILTO="root@csclub.uwaterloo.ca"
|
||||
# We were getting a lot of "some files vanished before they could be transferred" emails
|
||||
#MAILTO="root@csclub.uwaterloo.ca"
|
||||
MAILTO="no-reply@csclub.uwaterloo.ca"
|
||||
# HUB=false
|
||||
|
||||
########################################################################
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
MIRRORNAME=mirror.csclub.uwaterloo.ca
|
||||
TO="/mirror/root/debian"
|
||||
MAILTO="root@csclub.uwaterloo.ca"
|
||||
# We were getting a lot of "some files vanished before they could be transferred" emails
|
||||
#MAILTO="root@csclub.uwaterloo.ca"
|
||||
MAILTO="no-reply@csclub.uwaterloo.ca"
|
||||
# HUB=false
|
||||
|
||||
########################################################################
|
||||
|
|
|
@ -66,7 +66,7 @@ func (logger *Logger) log(level int, v ...interface{}) {
|
|||
args = append(args, v...)
|
||||
|
||||
logger.SetOutput(f)
|
||||
logger.Println(args)
|
||||
logger.Println(args...)
|
||||
}
|
||||
|
||||
// write debug information to the logfile
|
||||
|
|
|
@ -472,3 +472,19 @@ sync_type = csc-sync-ceph
|
|||
frequency = tri-hourly
|
||||
local_dir = ceph
|
||||
rsync_host = download.ceph.com
|
||||
|
||||
[termux]
|
||||
sync_type = csc-sync-standard
|
||||
frequency = twice-daily
|
||||
local_dir = termux
|
||||
rsync_host = grimler.se
|
||||
rsync_user = rsync
|
||||
rsync_dir = termux
|
||||
password_file = /home/mirror/passwords/termux
|
||||
|
||||
[archlinuxarm]
|
||||
sync_type = csc-sync-standard
|
||||
frequency = bi-hourly
|
||||
local_dir = archlinuxarm
|
||||
rsync_host = mirrors.ocf.berkeley.edu
|
||||
rsync_dir = archlinuxarm
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"git.csclub.uwaterloo.ca/public/merlin/sync"
|
||||
)
|
||||
|
||||
var DEFAULT_CONFIG_PATH = "merlin-config.ini"
|
||||
const DEFAULT_CONFIG_PATH = "merlin-config.ini"
|
||||
|
||||
func main() {
|
||||
|
||||
|
@ -96,18 +96,19 @@ func main() {
|
|||
}
|
||||
runAsManyAsPossible()
|
||||
|
||||
runLoop:
|
||||
mainLoop:
|
||||
for {
|
||||
timer := time.NewTimer(1 * time.Minute)
|
||||
select {
|
||||
case <-stopSig: // caught a SIGINT or SIGTERM
|
||||
// kill all syncing repos and the socket listener
|
||||
close(stopChan)
|
||||
close(stopLisChan)
|
||||
break runLoop
|
||||
break mainLoop
|
||||
|
||||
case <-reloadSig: // caught a SIGHUP
|
||||
// temporary stop the socket listener and load the config again
|
||||
stopLisChan <- struct{}{}
|
||||
close(stopLisChan)
|
||||
loadConfig()
|
||||
|
||||
case done := <-doneChan: // a sync is done and sends its exit status
|
||||
|
@ -132,32 +133,28 @@ runLoop:
|
|||
// close the received connection so that the message is sent
|
||||
conn.Close()
|
||||
|
||||
case <-time.After(1 * time.Minute):
|
||||
case <-timer.C:
|
||||
}
|
||||
timer.Stop()
|
||||
runAsManyAsPossible()
|
||||
}
|
||||
|
||||
// allow some time for jobs to terminate before force exiting the program
|
||||
go func() {
|
||||
<-time.After(time.Minute)
|
||||
time.Sleep(1 * time.Minute)
|
||||
logger.ErrLog("One minute has passed, forcefully exiting the program")
|
||||
os.Exit(1)
|
||||
}()
|
||||
|
||||
// wait on repos to get terminated
|
||||
for {
|
||||
select {
|
||||
case done := <-doneChan:
|
||||
if repo, check := config.RepoMap[done.Name]; check {
|
||||
sync.SyncCompleted(repo, done.Exit)
|
||||
}
|
||||
numJobsRunning--
|
||||
|
||||
case <-time.After(1 * time.Second):
|
||||
done := <-doneChan
|
||||
if repo, check := config.RepoMap[done.Name]; check {
|
||||
sync.SyncCompleted(repo, done.Exit)
|
||||
}
|
||||
|
||||
numJobsRunning--
|
||||
if numJobsRunning <= 0 {
|
||||
<-time.After(1 * time.Second) // wait a sec for file writes to complete
|
||||
time.Sleep(1 * time.Second) // wait a sec for file writes to complete
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,9 +52,10 @@ func spawnProcess(repo *config.Repo, args []string) (ch <-chan *exec.Cmd) {
|
|||
repo.Logger.Error("Could not send signal to process:", err)
|
||||
return
|
||||
}
|
||||
|
||||
timer := time.NewTimer(30 * time.Second)
|
||||
defer timer.Stop()
|
||||
select {
|
||||
case <-time.After(30 * time.Second):
|
||||
case <-timer.C:
|
||||
repo.Logger.Warning("Process still hasn't stopped after 30 seconds; sending SIGKILL")
|
||||
cmd.Process.Signal(syscall.SIGKILL)
|
||||
|
||||
|
@ -72,6 +73,8 @@ func spawnProcess(repo *config.Repo, args []string) (ch <-chan *exec.Cmd) {
|
|||
defer func() {
|
||||
cmdChan <- cmd
|
||||
}()
|
||||
timer := time.NewTimer(time.Duration(repo.MaxTime) * time.Second)
|
||||
defer timer.Stop()
|
||||
select {
|
||||
case <-cmdDoneChan:
|
||||
if !cmd.ProcessState.Success() {
|
||||
|
@ -84,7 +87,7 @@ func spawnProcess(repo *config.Repo, args []string) (ch <-chan *exec.Cmd) {
|
|||
repo.Logger.Debug("Received signal to stop, killing process...")
|
||||
killProcess()
|
||||
|
||||
case <-time.After(time.Duration(repo.MaxTime) * time.Second):
|
||||
case <-timer.C:
|
||||
repo.Logger.Warning("Process has exceeded its max time; killing now")
|
||||
killProcess()
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ directories:
|
|||
site: archlinux.org
|
||||
url: https://www.archlinux.org/
|
||||
|
||||
archlinuxarm:
|
||||
site: archlinuxarm.org
|
||||
url: https://archlinuxarm.org/
|
||||
|
||||
artixlinux:
|
||||
site: artixlinux.org
|
||||
url: https://artixlinux.org/
|
||||
|
@ -278,3 +282,7 @@ directories:
|
|||
trisquel:
|
||||
site: trisquel.info
|
||||
url: https://trisquel.info/
|
||||
|
||||
termux:
|
||||
site: termux.dev
|
||||
url: https://termux.dev/
|
||||
|
|
Loading…
Reference in New Issue