summaryrefslogtreecommitdiff
path: root/etc/functions/put
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-10-19 15:38:46 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-10-19 15:38:46 +0200
commit1566e67c192863e1f018df5e37b6267f2d05ecc0 (patch)
tree2c15807105136a3789333717cb795fbeca9f273b /etc/functions/put
parent341cf98a257b6e3ca210f0f5b0f38c720b559f48 (diff)
fput functions: Added aneurysm_int and additional error checking
Diffstat (limited to 'etc/functions/put')
-rw-r--r--etc/functions/put24
1 files changed, 20 insertions, 4 deletions
diff --git a/etc/functions/put b/etc/functions/put
index 2773416..32fdc79 100644
--- a/etc/functions/put
+++ b/etc/functions/put
@@ -9,6 +9,14 @@ typeset hostname
typeset -a ssh_options hosts
typeset target_dir server_prefix
typeset file
+typeset -i n_hosts n_ping n_curl
+
+function put_aneurysm_int {
+ hostname='aneurysm'
+ ssh_options=(-q)
+ target_dir='public_html/tmp/'
+ server_prefix='https://derf.homelinux.org/~derf/tmp/'
+}
function put_aneurysm () {
hostname='derf.homelinux.org'
@@ -24,7 +32,8 @@ function put_sievert () {
server_prefix='https://tabularazor.org/~derf/tmp/'
}
-hosts=(aneurysm sievert)
+hosts=(aneurysm_int aneurysm sievert)
+n_hosts=$#hosts
if [[ -f $1 ]] {
file=$1
@@ -34,13 +43,20 @@ if [[ -f $1 ]] {
if (( ? == 0 )) {
scp $ssh_options $file $hostname:$target_dir
ssh $ssh_options $hostname "chmod 644 $target_dir${file:t}"
- echo $server_prefix${file:t}
- return 0
+ if $(curl -fI $server_prefix${file:t} &> /dev/null); then
+ echo $server_prefix${file:t}
+ return 0
+ else
+ (( n_curl++ ))
+ fi
} else {
+ (( n_ping++ ))
shift hosts
}
}
- fdie "No hosts reachable"
+ fdie "Tried uploading to $n_hosts hosts without succes\n" \
+ " - $n_ping hosts are unreachable\n" \
+ " - $n_curl errors while uploading"
} else {
fdie "$1: No such file"
}