#!/usr/bin/env bash
#
# Copyright (c) 2004 VA Linux Systems Japan, K.K
#
# LICENSE NOTICE
#
#  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 2 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.
#
#

# statuscpy <from> <to> <pidfile>

set -e

if test "x$3" = "x"; then
  echo "Usage: $0 <from> <to> <pidfile>" 1>&2
  exit 1
fi

trap "/bin/rm -f $3" 0

echo $$ > $3

/bin/cat $1 > $2.$$
/bin/mv $2.$$ $2

/bin/rm -f $3

