less than 1 minute read

it is kinda nice to have a rsync job running while the bandwidth is not needed otherwise.

  1. start a main script each night (using cron)
  2. the main script uses timeout to overlook the actual rsync script

[code language="bash" collapse="true" title="main script"]
#!/bin/bash

# duration when the command should be killed
TIME=15
TIMEUNIT="m"

# which kill signal should be given
# 1: gracefully
# 9: hard?
KILLCMD=1

timeout -s $KILLCMD \
${TIME}${TIMEUNIT} \
/some/path/rsyncer.sh
[/code]

rsync script as in this post rsync backup script