aboutsummaryrefslogtreecommitdiffstats
path: root/vespabase/src/vespa-core-dumper.sh
blob: 5f9baadf4fc067e43fd966aca49c872c1dca1152 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

log_message () {
    echo "warning   $*" | logger -t vespa-core-dumper
}

compressor=$1
corefile=$2
option=$3

log_message "Starting $compressor > $corefile"


if [ -f "$corefile" ]
then
    if [ "$option" != "overwrite" ]
    then
        log_message "$corefile is read-only. Core is not dumped."
        exit 1
    else
        log_message "Overwriting $corefile"
    fi
fi

$compressor > $corefile
chmod 444 $corefile
log_message "Finished $compressor > $corefile"