1. Use the timer: In the logs directory, a file is generated every two minutes
(the file format is: 201711151323.log, 201711151323.log, 2017111513xx.log ...
Idea: The timer calls the shell script regularly, and the script creates the file according to the time,
And append the content of the file beicai.log to the log file.
#vi filetime.sh
#!/bin/bash
cd /home/hadoop/hadoop-2.6.1/logs
d=`date +%Y%m%d%H%M`
touch $d.log
cd /home/hadoop
cat beicai.log >> /home/hadoop/hadoop-2.6.1/logs/$d.log
#crontab -e
*/2 * * * * /home/hadoop/filetime.sh