Time code under linux date

  
 

There are two servers on the company's website with little hard disk space, so you have to clean up the logs in a day or two. But this consumes a lot of manpower and time, and sometimes it may be forgotten that once the log is full, users will not be able to access our website. At this time we have to let the script clean up the log every day: every night at 0 o'clock, run the script through crontab to move yesterday's log package to other servers (here I used NFS, the local directory is mounted to other servers with large hard disk space) Previous) • Linux yesterday: date -d ‘yesterday’ +”%Y_%m_%d” or date -d ‘-1 day’ +”%Y_%m_%d” or date -d &lsquo ;1 days ago’ +”%Y_%m_%d”• the day before yesterday: date -d ‘-2 day’ +”%Y_%m_%d” or date -d ‘2 days ago’ +&rdquo ;%Y_%m_%d”•大天天:date -d ‘-3 day’ +”%Y_%m_%d” or date -d ‘3 days ago’ +”%Y_%m_%d&rdquo ;•Tomorrow: date -d ‘tomorrow’ +”%Y_%m_%d” or date -d ‘1 day’ +”%Y_%m_%d”

Copyright © Windows knowledge All Rights Reserved