Project

General

Profile

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