#!/bin/bash # last updated Friday May 17, 2013 # # Automatic (s)tfp upload for corz.org.. # A part of corz website sync # # Use http://corz.org/source/php/website-sync-linux.php # to create the commands for this.. # # get host name.. if [ -z $1 ]; then echo echo "Please supply a domain name on the command-line. e.g.." echo echo "$0 foobar.net" echo echo "corz-upload will then use settings file: ~/.sftp/foobar.net" echo exit 1 fi # grab settings.. . ~/.sftp/$1 sftp -b "/usr/local/bin/$host/up" $user@$host rc=$? if [ $rc != 0 ]; then echo "**WARNING** up sftp for $host returned an error: $rc" echo "**WARNING** up sftp for $host returned an error: $rc"|mailx -s "Error in up sftp!" postmaster exit $rc fi now=`date "+%Y.%m.%d-%H.%M"` command -v fortune >/dev/null 2>&1 || { echo "Smile! It's real-time!"; exit 0; } fortune echo "upload for $host complete at $now" exit 0