| 1 | #!/bin/bash |
|---|
| 2 | ##+----------------------------------------------------------------------------- |
|---|
| 3 | ##+ Isidorus |
|---|
| 4 | ##+ (c) 2008-2010 Marc Kuester, Christoph Ludwig, Lukas Georgieff |
|---|
| 5 | ##+ |
|---|
| 6 | ##+ Isidorus is freely distributable under the LLGPL license. |
|---|
| 7 | ##+ You can find a detailed description in trunk/docs/LLGPL-LICENSE.txt and |
|---|
| 8 | ##+ trunk/docs/LGPL-LICENSE.txt. |
|---|
| 9 | ##+----------------------------------------------------------------------------- |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | ## This script can be used to invoke hunchentoot's admin interface and backup |
|---|
| 13 | ## the server date. The default ip address is set to 127.0.0.1 and can be changed via |
|---|
| 14 | ## the switch -host <ip-address>. The default url that determines the server's |
|---|
| 15 | ## callback binding is set to /admin/backup, but this behavior can also be |
|---|
| 16 | ## changed by using the switch -url <url-fragment>. The path variable |
|---|
| 17 | ## contains the name of the stored xtm backup file that is created, the default |
|---|
| 18 | ## value is a date string of the form dd.mm.yyyy:hh:mm:ss.xtm" and can be |
|---|
| 19 | ## changed by using the switch -path <any-string>. |
|---|
| 20 | ## A sample call would be |
|---|
| 21 | ## ./local-backup-isidorus.sh -host 12.34.56.78 -url /admin/shutdown -path=backup.xtm |
|---|
| 22 | |
|---|
| 23 | url="/admin/local-backup"; |
|---|
| 24 | host="127.0.0.1:11008"; |
|---|
| 25 | path=`date +"%d.%m.%y:%H:%M:%S"`".xtm" |
|---|
| 26 | |
|---|
| 27 | if [ $# -eq 0 ]; then |
|---|
| 28 | : |
|---|
| 29 | elif [ $# -eq 1 -a $1 = "?" ]; then |
|---|
| 30 | echo "you can pass the arguments -host <host-url>, -url </url-fragment> and -path <any-string>, if no arguments are passed the default values 127.0.0.1:11008, /admin/backup and <current-data>.xtm are used"; |
|---|
| 31 | exit; |
|---|
| 32 | elif [ $# -eq 2 ]; then |
|---|
| 33 | if [ $1 = "-host" ]; then |
|---|
| 34 | host=$2; |
|---|
| 35 | elif [ $1 = "-url" ]; then |
|---|
| 36 | url=$2; |
|---|
| 37 | elif [ $1 = "-path" ]; then |
|---|
| 38 | path=$2; |
|---|
| 39 | else |
|---|
| 40 | echo "only the arguments -host, -url and -path are supported, use ? for more information"; |
|---|
| 41 | exit; |
|---|
| 42 | fi |
|---|
| 43 | elif [ $# -eq 4 ]; then |
|---|
| 44 | if [ $1 = "-host" ]; then |
|---|
| 45 | host=$2; |
|---|
| 46 | elif [ $1 = "-url" ]; then |
|---|
| 47 | url=$2; |
|---|
| 48 | elif [ $1 = "-path" ]; then |
|---|
| 49 | path=$2; |
|---|
| 50 | else |
|---|
| 51 | echo "only the arguments -host, -url and path are supported, use ? for more information"; |
|---|
| 52 | exit; |
|---|
| 53 | fi |
|---|
| 54 | |
|---|
| 55 | if [ $3 = "-host" ]; then |
|---|
| 56 | host=$4; |
|---|
| 57 | elif [ $3 = "-url" ]; then |
|---|
| 58 | url=$4; |
|---|
| 59 | elif [ $3 = "-path" ]; then |
|---|
| 60 | path=$4; |
|---|
| 61 | else |
|---|
| 62 | echo "only the arguments -host, -url and path are supported, use ? for more information"; |
|---|
| 63 | exit; |
|---|
| 64 | fi |
|---|
| 65 | elif [ $# -eq 6 ]; then |
|---|
| 66 | if [ $1 = "-host" ]; then |
|---|
| 67 | host=$2; |
|---|
| 68 | elif [ $1 = "-url" ]; then |
|---|
| 69 | url=$2; |
|---|
| 70 | elif [ $1 = "-path" ]; then |
|---|
| 71 | path=$2; |
|---|
| 72 | else |
|---|
| 73 | echo "only the arguments -host, -url and path are supported, use ? for more information"; |
|---|
| 74 | exit; |
|---|
| 75 | fi |
|---|
| 76 | |
|---|
| 77 | if [ $3 = "-host" ]; then |
|---|
| 78 | host=$4; |
|---|
| 79 | elif [ $3 = "-url" ]; then |
|---|
| 80 | url=$4; |
|---|
| 81 | elif [ $3 = "-path" ]; then |
|---|
| 82 | path=$4; |
|---|
| 83 | else |
|---|
| 84 | echo "only the arguments -host, -url and path are supported, use ? for more information"; |
|---|
| 85 | exit; |
|---|
| 86 | fi |
|---|
| 87 | if [ $5 = "-host" ]; then |
|---|
| 88 | host=$6; |
|---|
| 89 | elif [ $5 = "-url" ]; then |
|---|
| 90 | url=$6; |
|---|
| 91 | elif [ $5 = "-path" ]; then |
|---|
| 92 | path=$6; |
|---|
| 93 | else |
|---|
| 94 | echo "only the arguments -host, -url and path are supported, use ? for more information"; |
|---|
| 95 | exit; |
|---|
| 96 | fi |
|---|
| 97 | else |
|---|
| 98 | echo "only the arguments -host, -url and path are supported, use ? for more information"; |
|---|
| 99 | exit; |
|---|
| 100 | fi |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | curl $host$url"?path="$path; |
|---|