1
|
#!/bin/sh
|
2
|
#
|
3
|
# rc.savecore
|
4
|
#
|
5
|
# part of pfSense (https://www.pfsense.org)
|
6
|
# Copyright (c) 2004-2013 BSD Perimeter
|
7
|
# Copyright (c) 2013-2016 Electric Sheep Fencing
|
8
|
# Copyright (c) 2014-2021 Rubicon Communications, LLC (Netgate)
|
9
|
# All rights reserved.
|
10
|
#
|
11
|
# Based on src/etc/rc.d/savecore from FreeBSD
|
12
|
#
|
13
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
14
|
# you may not use this file except in compliance with the License.
|
15
|
# You may obtain a copy of the License at
|
16
|
#
|
17
|
# http://www.apache.org/licenses/LICENSE-2.0
|
18
|
#
|
19
|
# Unless required by applicable law or agreed to in writing, software
|
20
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
21
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22
|
# See the License for the specific language governing permissions and
|
23
|
# limitations under the License.
|
24
|
|
25
|
dumpdev=`/bin/realpath -q /dev/dumpdev`
|
26
|
dumpdir='/var/crash'
|
27
|
|
28
|
if [ ! -c "${dumpdev}" ]; then
|
29
|
echo "Dump device does not exist. Savecore not run."
|
30
|
exit
|
31
|
fi
|
32
|
|
33
|
if [ ! -d "${dumpdir}" ]; then
|
34
|
echo "Dump directory does not exist. Savecore not run."
|
35
|
exit
|
36
|
fi
|
37
|
|
38
|
if savecore -C "${dumpdev}" >/dev/null; then
|
39
|
savecore ${dumpdir} ${dumpdev}
|
40
|
else
|
41
|
echo 'No core dumps found.'
|
42
|
fi
|