-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscp_apache_logs.sh
More file actions
28 lines (28 loc) · 947 Bytes
/
scp_apache_logs.sh
File metadata and controls
28 lines (28 loc) · 947 Bytes
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
#
# Author: norman00
# Date: 12/06/2016
#
# Description: The following script copies apache logs
# from 6pm to 9pm to a remote server
#
# Variables explanation
#
# LOG: Log name, to be copied to remote server
# IP: Remote server IP address
# LOGDIRECTORY: Local directory were apache logs reside
# TRANSFERLOG: Local file that logs transfer history and status
# U: Username to make secure copy
# STORE: Directory on remote server were logs are stored
#
# = = = = = = = = = = = = = = = = = = = = = = = = =
LOG=$(date +"%Y_%m_%d_%H".log)
IP=192.168.56.104
LOGDIRECTORY=/home/erascong/Documents/jail/3pic/logs
TRANSFERLOG=/home/erascong/Documents/jail/3pic/transfer.log
U=operator
STORE=/archive/logs/
/usr/bin/touch $TRANSFERLOG
date >> $TRANSFERLOG
scp $LOGDIRECTORY/$LOG $U@$IP:$STORE && echo $LOG" successfully saved" >> $TRANSFERLOG
# End of script