shell script file to back up the current date

#! / bin / the bash 
# previous month 
historyTime = $ ( DATE  " + M-% D%%% Y-H " -d ' . 1 month The ago Member ' )
 echo $ {} historyTime 
historyTimeStamp = $ ( DATE -d " $ historyTime " +% S)
 echo $ {} historyTimeStamp 
 
# week before 
$ ( DATE  " + M-% D%%% Y-H " -d ' . 7 Day ago Member ' ) 
 
# month January 
date_this_month =` DATE + the Y-%% m01` 
 
# day before 
date_today=`date -d '1 day ago' +%Y%m%d`
 
#一小时前
$(date "+%Y-%m-%d %H" -d '-1 hours')

Backup and delete the first two months of the backup file

! # / bin / SH 
Source / etc / Profile 
# Get the current date 
YMD = ` DATE +% the Y% m% d`; 
# 2 months obtaining 
historyTime = $ ( DATE  " + the Y% m% " -d ' 2 ago Member month The ' ) 
# print date 
echo $ {} historyTime
 RM -rf ci_admin.jar.bak- $ historyTime *
 CP ci_admin.jar ci_admin.jar.bak- $ YMD

 

 

Guess you like

Origin www.cnblogs.com/SimonHu1993/p/11511191.html