File: do-not-modify-previous-crontabs

package info (click to toggle)
cron 3.0pl1-162
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,204 kB
  • sloc: ansic: 47,007; perl: 733; makefile: 429; sh: 425; python: 36
file content (25 lines) | stat: -rw-r--r-- 895 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /bin/sh

set -e

dir=$(pwd)/debian/tests
. $dir/textutils.sh

frame "This test is to check that installing cron (and cron-daemon-common)" \
      "keep enventually a previous version of crontab without changes."

echo "================= purge cron and cron-daemon-common ================="
apt-get --yes purge cron cron-daemon-common
echo "========== create the file /etc/crontab with fancy contents ========="

cat > /etc/crontab <<EOF
# Hello, here is a fancy header for an "older" crontab
# Let us see whether an install of packages cron-daemon-common and cron
#   will preserve the original file ...
EOF

echo '=== install cron, reply "N" when prompted to replace /etc/crontab ==='
echo "N" | apt-get --yes install cron 2>/dev/null

grep -q "Hello, here is a fancy header for an \"older\" crontab" /etc/crontab
echo "===== cron-daemon-common did preserve older configuration files ====="