#!/bin/bash

# Run cron tasks between 3am and 7am
TIME_RANGE="3-7"

if grep -q "^START_HOURS_RANGE=" /etc/anacrontab; then
  sed -i "s/^START_HOURS_RANGE=.*/START_HOURS_RANGE=$TIME_RANGE/" /etc/anacrontab
else
  sed -i "/^LONGNAME=root/a START_HOURS_RANGE=$TIME_RANGE" /etc/anacrontab
fi
