Project

General

Profile

Download (1.24 KB) Statistics
| Branch: | Tag: | Revision:
1 029d6129 NOYB
#!/bin/sh
2
#
3
# rc.backup_logs.sh
4
#
5
# part of pfSense (https://www.pfsense.org)
6 38809d47 Renato Botelho do Couto
# Copyright (c) 2016 Electric Sheep Fencing
7 0284d79e jim-p
# Copyright (c) 2016-2020 Rubicon Communications, LLC (Netgate)
8 029d6129 NOYB
# All rights reserved.
9
#
10
# Based on src/etc/rc.d/savecore from FreeBSD
11
#
12
# Licensed under the Apache License, Version 2.0 (the "License");
13
# you may not use this file except in compliance with the License.
14
# You may obtain a copy of the License at
15
#
16
# http://www.apache.org/licenses/LICENSE-2.0
17
#
18
# Unless required by applicable law or agreed to in writing, software
19
# distributed under the License is distributed on an "AS IS" BASIS,
20
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
# See the License for the specific language governing permissions and
22
# limitations under the License.
23
24
: ${DBPATH:=/var/log}
25
: ${CF_CONF_PATH:=/cf/conf}
26
27
: ${RAM_Disk_Store:=${CF_CONF_PATH}/RAM_Disk_Store}
28
29
# Save the logs database to the RAM disk store.
30
if [ -d "${DBPATH}" ]; then
31
	echo -n "Saving Logs to RAM disk store...";
32
33
	[ -f "${RAM_Disk_Store}/logs.tgz" ] && /bin/rm -f "${RAM_Disk_Store}/logs.tgz"
34
35
	if [ ! -d "${RAM_Disk_Store}" ]; then
36
		mkdir -p "${RAM_Disk_Store}"
37
	fi
38
39
	/usr/bin/tar -czf "${RAM_Disk_Store}/logs.tgz" -C / "${DBPATH#/}/"
40
41
	echo "done.";
42
fi