forked from bostoneboy/shell-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathftp-transfer.sh
43 lines (37 loc) · 1.13 KB
/
ftp-transfer.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Author: Bill_JaJa
# Modify Date: 2009/11/20
LANG=C;export
log_name="ht-smpp2-`date "+%y%m%d"`.log"
l_log_dir="/dailycheck/log/dailylog/`date +%Y%m`"
r_log_dir="/dailycheck/log/globlelog/`date +%Y%m`"
# fill below for remote ftp server.
remote_ip=""
remote_username=""
remote_password=""
echo "`date '+%m-%d %H:%M:%S'` start checking system."
if [ ! -d $l_log_dir ]
then
mkdir -p $l_log_dir
if [ $? -eq 0 ]
then
echo "`date '+%m-%d %H:%M:%S'` create new dirctory [$l_log_dir] success..."
else
echo "`date '+%m-%d %H:%M:%S'` create new dirctory [$l_log_dir] failed..."
echo "`date '+%m-%d %H:%M:%S'` please check the error..."
fi
fi
sh /dailycheck/scripts/dailycheck.sh > $l_log_dir/$log_name
echo "`date '+%m-%d %H:%M:%S'` create log file [$log_name] success..."
ftp -n<<!
open $remote_ip
user $remote_username $remote_password
cd $r_log_dir
lcd $l_log_dir
prompt
put $log_name
close
bye
!
echo "`date '+%m-%d %H:%M:%S'` push log file [$log_name] to server success..."
echo ">>>>>>>>>>>>>>>>>Finish at `date '+%Y-%m-%d %H:%M:%S'`<<<<<<<<<<<<<<<<<\n"