~hloeung/ubuntu-repository-cache/splay-cron-daily

« back to all changes in this revision

Viewing changes to reactive/ubuntu_repository_cache.py

  • Committer: Haw Loeung
  • Date: 2021-03-11 23:42:29 UTC
  • Revision ID: haw.loeung@canonical.com-20210311234229-760rejjfcsv0s7uo
Ensure daily apache2 graceful restart is splayed

We ship out a random sleep script to cron.daily to ensure that
graceful restarts from logrotation is spread out across the various
units.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
import os
8
8
import pwd
 
9
import shutil
9
10
 
10
11
from charms import reactive
11
12
from charms.layer import status
68
69
        LOG('Disabling {}'.format(azure_disk_warning))
69
70
        host.service_pause(azure_disk_warning)
70
71
 
 
72
    # We want to ensure not all units rotate out and graceful
 
73
    # restart/reload apache at the same time.
 
74
    shutil.copy2('files/cron_random_sleep.sh', '/etc/cron.daily/000-cron-random-sleep')
 
75
 
71
76
    reactive.set_flag('ubuntu-repository-cache.configured')
72
77
 
73
78