This file is indexed.

/usr/bin/rsbackup.cron is in rsbackup 3.0-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#! /bin/sh
#
# Copyright © 2011, 2014, 2015 Richard Kettlewell.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
set -e

# Functions -------------------------------------------------------------------

verbosely() {
  echo "$@" >&2
  "$@"
}

# Initial settings ------------------------------------------------------------

backupargs=""
pruneargs=""
reportargs=""
wait=""
dryrun=""
verbose=""
nicely=""

# Parse command line ----------------------------------------------------------

while [ $# -gt 0 ]; do
  case "$1" in
  -n | --dry-run )
    dryrun="--dry-run"
    shift
    ;;
  -v | --verbose )
    verbose=verbosely
    shift
    ;;
  -h | --help )
    cat <<EOF
Usage:
  rsbackup.cron [OPTIONS] FREQUENCY
Options:
  --dry-run          Pass --dry-run to rsbackup command
  --verbose          Display rsbackup command before running it
  --help, -h         Display usage message
  --version, -V      Display version string
  FREQUENCY          Must be hourly, daily, weekly or monthly

Intended to be cron from /etc/cron.FREQUENCY/rsbackup.
EOF
    exit 0
    ;;
  -V | --version )
    echo "rsbackup.cron 3.0"
    exit 0
    ;;
  -- )
    shift
    break
    ;;
  -* )
    echo >&2 "rsbackup.cron: unknown option '$1'"
    exit 1
    ;;
  * )
    break
    ;;
  esac
done

# Get frequency
frequency="$1"

# Read configuration ----------------------------------------------------------

. /etc/rsbackup/defaults

# Validate frequency ----------------------------------------------------------

# For lower frequencies, we always wait until we can take the lock.
case "$frequency" in
hourly )
  hosts="$hourly"
  ;;
daily )
  hosts="$daily"
  wait="--wait"
  ;;
weekly )
  hosts="$weekly"
   wait="--wait"
  ;;
monthly )
  hosts="$monthly"
  wait="--wait"
  ;;
* )
  echo >&2 "rsbackup.cron: unrecognize frequency '$frequency'"
  exit 1
esac

# Decide what to back up ------------------------------------------------------

case "$hosts" in
"" )
  ;;
_all )
  backupargs="$backupargs --backup"
  ;;
* )
  backupargs="$backupargs --backup $hosts"
  ;;
esac

# Decide whether to prune -----------------------------------------------------

# Prune old backups
if [ "$prune" = "$frequency" ]; then
  pruneargs="$pruneargs --prune"
fi

# Prune incomplete backups
if [ "$prune_incomplete" = "$frequency" ]; then
  pruneargs="$pruneargs --prune-incomplete"
fi

# Decide whether to generate a report -----------------------------------------

# Generate an email report
if [ "$report" = "$frequency" ] && [ "$email" != "" ]; then
  reportargs="$reportargs --email $email"
fi

# Act -------------------------------------------------------------------------

# We separate pruning from backup up because otherwise only the
# backed-up hosts are pruned.

if [ "x$backupargs" != x ]; then
  $verbose $nicely rsbackup $wait $dryrun $backupargs || true
fi

if [ "x$pruneargs" != x ]; then
  $verbose $nicely rsbackup $wait $dryrun $pruneargs || true
fi

if [ "x$reportargs" != x ]; then
  $verbose $nicely rsbackup $wait $dryrun $reportargs || true
fi

# That's all ------------------------------------------------------------------