Project

General

Profile

Download (1.19 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2
#
3
# rc.backup_logs.sh
4
#
5
# part of pfSense (https://www.pfsense.org)
6
# Copyright (c) 2016 Rubicon Communications, LLC (Netgate)
7
# All rights reserved.
8
#
9
# Based on src/etc/rc.d/savecore from FreeBSD
10
#
11
# 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
#
15
# http://www.apache.org/licenses/LICENSE-2.0
16
#
17
# 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

    
23
: ${DBPATH:=/var/log}
24
: ${CF_CONF_PATH:=/cf/conf}
25

    
26
: ${RAM_Disk_Store:=${CF_CONF_PATH}/RAM_Disk_Store}
27

    
28
# Save the logs database to the RAM disk store.
29
if [ -d "${DBPATH}" ]; then
30
	echo -n "Saving Logs to RAM disk store...";
31

    
32
	[ -f "${RAM_Disk_Store}/logs.tgz" ] && /bin/rm -f "${RAM_Disk_Store}/logs.tgz"
33

    
34
	if [ ! -d "${RAM_Disk_Store}" ]; then
35
		mkdir -p "${RAM_Disk_Store}"
36
	fi
37

    
38
	/usr/bin/tar -czf "${RAM_Disk_Store}/logs.tgz" -C / "${DBPATH#/}/"
39

    
40
	echo "done.";
41
fi
(16-16/79)