diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2016-02-27 15:58:12 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2016-02-27 15:58:12 +0100 |
commit | a307e0474e78c51590aeac95dbc5587a87ef6501 (patch) | |
tree | c5c7ca86b0b86704a4c1adc588e7ce249826e98f /packages/scripts-cern | |
parent | 77955935e9549a847ae7e0d78819f090d429fdb6 (diff) | |
download | debian-packages-a307e0474e78c51590aeac95dbc5587a87ef6501.tar.gz debian-packages-a307e0474e78c51590aeac95dbc5587a87ef6501.zip |
refactor scripts packages
Diffstat (limited to 'packages/scripts-cern')
-rw-r--r-- | packages/scripts-cern/build.gradle | 6 | ||||
-rwxr-xr-x | packages/scripts-cern/resources/bin/database-tunnels.sh | 48 | ||||
-rwxr-xr-x | packages/scripts-cern/resources/bin/restart-gwt.sh | 16 | ||||
-rw-r--r-- | packages/scripts-cern/resources/lib/aisadm-fingerprint | 5 |
4 files changed, 75 insertions, 0 deletions
diff --git a/packages/scripts-cern/build.gradle b/packages/scripts-cern/build.gradle new file mode 100644 index 0000000..d10b19e --- /dev/null +++ b/packages/scripts-cern/build.gradle @@ -0,0 +1,6 @@ +version '1.0' + +ospackage { + into "/opt/${project.name}" + from files('resources') +} diff --git a/packages/scripts-cern/resources/bin/database-tunnels.sh b/packages/scripts-cern/resources/bin/database-tunnels.sh new file mode 100755 index 0000000..1f74c84 --- /dev/null +++ b/packages/scripts-cern/resources/bin/database-tunnels.sh @@ -0,0 +1,48 @@ +#!/bin/bash +REMOTE_UNC_PATH="//cerndfs.cern.ch/dfs/Applications/Oracle" +AISADM_IP=aisadm.cern.ch +AISADM_FINGERPRINT="`dirname \"$0\"`/../lib/aisadm-fingerprint" +SSH_USER=$USER +TNSNAMES="$HOME/.cache/tnsnames" +LOCAL=false +TEMP=`getopt -o phl: --long help,local,user: \ + -n '$0' -- "$@"` +if [ $? != 0 ] ; then echo "Failed to parse arguments..." >&2 ; exit 1 ; fi + +# Note the quotes around `$TEMP': they are essential! +eval set -- "$TEMP" + +function print() { echo -e "\e]0;$1\a"; echo "$1"; } + +while true ; do + case "$1" in + -p|--local) LOCAL=true ; shift ;; + -l|--user) shift; SSH_USER=$1; shift ;; + -h|--help) echo "$0 [--help|--local] [-l <name>|--user <name>]"; exit 0;; + --) shift ; break ;; + *) echo "Internal error! ($*)" ; exit 1 ;; + esac +done + +if ! $LOCAL; then + print "Mirror tnsnames.ore files to $TNSNAMES" && + mkdir -p "$TNSNAMES/admin" "$TNSNAMES/admin_localhost" && + smbclient -k "$REMOTE_UNC_PATH" -D ADMIN_localhost -TXc - 'ADMIN_localhost/OLD' | tar --strip-components=2 -x -C "$TNSNAMES/admin_localhost" && + smbclient -k "$REMOTE_UNC_PATH" -D ADMIN -TXc - 'ADMIN/OLD'| tar --strip-components=2 -x -C "$TNSNAMES/admin" || + echo "failed to mirror tnsnames to $TNSNAMES" >&2 +fi + +if $LOCAL; then + SSH_EXTRAOPTS="-oProxyCommand=ssh -l \"$SSH_USER\" lxplus.cern.ch nc $AISADM_IP 22" +else + true +fi + +print "Database Tunnel" && + ssh -l "$SSH_USER" \ + -L 10301:cman1.cern.ch:10300 -L 10302:cman2.cern.ch:10300 \ + -o UserKnownHostsFile=$AISADM_FINGERPRINT \ + ${SSH_EXTRAOPTS:+"$SSH_EXTRAOPTS"} \ + $AISADM_IP \ + "date; echo tunnel is running; cat" + diff --git a/packages/scripts-cern/resources/bin/restart-gwt.sh b/packages/scripts-cern/resources/bin/restart-gwt.sh new file mode 100755 index 0000000..3870874 --- /dev/null +++ b/packages/scripts-cern/resources/bin/restart-gwt.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -x +pid=`jps | grep DevMode | cut -f 1 -d ' '` +if [ -z "$pid" ]; then + echo "no running gwt-client found" >&2 + exit 1 +fi + +cwd=`readlink "/proc/${pid}/cwd"` +cmd=`cat "/proc/${pid}/cmdline" | tr '\0' ' '` +cd "$cwd" +kill -9 "$pid" + +sleep 1 +$cmd >/dev/null 2>&1 & +disown -ar diff --git a/packages/scripts-cern/resources/lib/aisadm-fingerprint b/packages/scripts-cern/resources/lib/aisadm-fingerprint new file mode 100644 index 0000000..d913b51 --- /dev/null +++ b/packages/scripts-cern/resources/lib/aisadm-fingerprint @@ -0,0 +1,5 @@ +# Host aisadm found: line 139 type RSA +|1|yTV5M0N1SGVLpMKcu6+OfkwvC4o=|60gdtP9Qcp26ITFRkvKHIr/UMic= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4bg2L316l/5zs7S7hE69fev4tWYczJy/Yf2AI1rhG5j1+EXZKMnCUkm1bpZUNu8g2fzg/P6wPSTQyZmc7ieQaKoiz69ZQ2mr+bIi2ET+50DDO9ZzrVFnKeOzs669fSfWp3Y7o8ubTRx5t/nLrMTxSDUQxXitk1UV5mosE5yzlJ665zlEE8+rVsqhhBC7bfg2lJR5HptxpCR9kVSyLkHydEXC8WltW06bpBHEuvKWAkAMMfftOHowWLCEslOFUirpjR65uqK+da9v3SfUvOYF8JZCrw7yDutyx5bzqFVS3N39T/7QPGJLYRJip1DPh8OvtPOPLLbdPY76NrodmRn9aw== +# Host aisadm.cern.ch found: line 140 type RSA +|1|3Dv9PqxtXlsVD96Sc4b/l/XLc10=|hsaJh8u7r0/1olKy6ihcAQuOSfc= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4bg2L316l/5zs7S7hE69fev4tWYczJy/Yf2AI1rhG5j1+EXZKMnCUkm1bpZUNu8g2fzg/P6wPSTQyZmc7ieQaKoiz69ZQ2mr+bIi2ET+50DDO9ZzrVFnKeOzs669fSfWp3Y7o8ubTRx5t/nLrMTxSDUQxXitk1UV5mosE5yzlJ665zlEE8+rVsqhhBC7bfg2lJR5HptxpCR9kVSyLkHydEXC8WltW06bpBHEuvKWAkAMMfftOHowWLCEslOFUirpjR65uqK+da9v3SfUvOYF8JZCrw7yDutyx5bzqFVS3N39T/7QPGJLYRJip1DPh8OvtPOPLLbdPY76NrodmRn9aw== +|1|d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