When sending the dump to a remote server, add IP address
or hostname as a prefix to the timestamped directory.
IP address is the default.

Signed-off-by: Louis Bouchard <[email protected]>
---
 debian/kdump-config        | 14 ++++++++++++--
 debian/kdump-tools.default |  5 +++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/debian/kdump-config b/debian/kdump-config
index 1184d6d..d97de02 100755
--- a/debian/kdump-config
+++ b/debian/kdump-config
@@ -362,9 +362,19 @@ function kdump_save_core()
 function kdump_save_core_to_ssh()
 {
        KDUMP_SSH_KEY="${SSH_KEY:=/root/.ssh/kdump_id_rsa}"
-       KDUMP_STAMP=`date +"%Y%m%d%H%M"`
        KDUMP_REMOTE_HOST="$SSH"
-       KDUMP_STAMPDIR="$KDUMP_COREDIR/$KDUMP_STAMP"
+       KDUMP_STAMP=`date +"%Y%m%d%H%M"`
+       HOSTTAG="${HOSTTAG:=ip}"
+
+       if [ $HOSTTAG = "hostname" ];then
+               THIS_HOST="$(hostname)"
+       else
+               THIS_HOST="$(hostname -I)"
+               set -a $THIS_HOST
+               THIS_HOST=$1
+       fi
+
+       KDUMP_STAMPDIR="$KDUMP_COREDIR/$THIS_HOST-$KDUMP_STAMP"
        KDUMP_CORETEMP="$KDUMP_STAMPDIR/dump-incomplete"
        KDUMP_COREFILE="$KDUMP_STAMPDIR/dump.$KDUMP_STAMP"
        KDUMP_TMPDMESG="/tmp/dmesg.$KDUMP_STAMP"
diff --git a/debian/kdump-tools.default b/debian/kdump-tools.default
index 8ef95b8..c391f3c 100644
--- a/debian/kdump-tools.default
+++ b/debian/kdump-tools.default
@@ -71,9 +71,14 @@ KDUMP_COREDIR="/var/crash"
 # SSH_KEY - Full path of the ssh private key to be used to login to the remote
 #          server. use kdump-config propagate to send the public key to the
 #          remote server
+# HOSTTAG - Select if hostname of IP address will be used as a prefix to the
+#           timestamped directory when sending files to the remote server.
+#           'ip' is the default.
 #
 # SSH="<user@server>"
 #
+# HOSTTAG="hostname|[ip]"
+# 
 # NFS="<nfs mount>"
 #
 # NFS4="<nfs mount>"
-- 
1.9.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to