github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/contrib/cirrus/packer/systemd_banish.sh (about)

     1  #!/bin/bash
     2  
     3  set +e  # Not all of these exist on every platform
     4  
     5  # This is intended to be executed on VMs as a startup script on initial-boot.
     6  # Alternatively, it may be executed with the '--list' option to return the list
     7  # of systemd units defined for disablement (useful for testing).
     8  
     9  EVIL_UNITS="cron crond atd apt-daily-upgrade apt-daily fstrim motd-news systemd-tmpfiles-clean"
    10  
    11  if [[ "$1" == "--list" ]]
    12  then
    13      echo "$EVIL_UNITS"
    14      exit 0
    15  fi
    16  
    17  echo "Disabling periodic services that could destabilize testing:"
    18  for unit in $EVIL_UNITS
    19  do
    20      echo "Banishing $unit (ignoring errors)"
    21      (
    22          sudo systemctl stop $unit
    23          sudo systemctl disable $unit
    24          sudo systemctl disable $unit.timer
    25          sudo systemctl mask $unit
    26          sudo systemctl mask $unit.timer
    27      ) &> /dev/null
    28  done