To make it easier to copy code from a development server to a version control server, check the file, then check it in, I created a bash script.
This script is also supported with ssh keys so the password does not need to be entered with each copy request. Thanks to: http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/
# This script requires three parameters
# server - The name of the server where the code will be retrieved from
# file - The name of the file. In this case, the path is hardcoded.
# comment - A comment to include when checking in the file
if [ $# -lt 3 ]; then
echo ' ~/get.sh server file comment'
# Copy the file
scp root@$1.domain.com:/opt/system/web/portal/$2 NEW
# If the files can be compared
if [ -r NEW -a -r "$2" ]; then
# Create tmp file for the diff results
diff NEW "$2" > "$TMP"
# If the files are different
if [ $? -ne 0 ]; then
echo -n 'Update? y/[n]? '
if [ $REPLY == 'y' ]; then
# Checkout the file
cleartool co -nc "$2"
# Copy the new file over
cp NEW $2
# Checkin the updated file
cleartool ci -c "$3" "$2"
echo 'no changes made'
echo 'files are the same'
echo 'scp failed or files missing'