#!/bin/bash
#取得日期
mydate=`date -d"10 day ago" +"%Y%m%d"`
lastmonth=`date -d"1 day ago" +"%Y%m"`
month=`date +"%Y%m"`
yestady=`date -d"1 day ago" +"/%d"`
today=`date +"/%d"`
#设置目录
mydir="/k8/appdir/info.k8.cn/data/attachment/portal/"$month
lastmydir="/k8/appdir/info.k8.cn/data/attachment/portal/"$lastmonth
mydir="/z_data_back/shell/"$month
index="/index.html"
if [ -d $mydir ];then
mkdir $mydir$today
chmod 777 $mydir$today
touch $mydir$today$index
chmod 444 $mydir$today$index
else
mkdir $mydir
chmod 755 $mydir
touch $mydir$index
chmod 444 $mydir$index
mkdir $mydir$today
chmod 777 $mydir$today
touch $mydir$today$index
chmod 444 $mydir$today$index
fi
if [ -d $lastmydir$yestady ];then
chmod -R 755 $lastmydir$yestady
chmod 444 $lastmydir$yestady$index
fi
if [ $lastmonth -ne $month ];then
chmod 755 $lastmydir
fi
#取得日期
mydate=`date -d"10 day ago" +"%Y%m%d"`
lastmonth=`date -d"1 day ago" +"%Y%m"`
month=`date +"%Y%m"`
yestady=`date -d"1 day ago" +"/%d"`
today=`date +"/%d"`
#设置目录
mydir="/k8/appdir/info.k8.cn/data/attachment/portal/"$month
lastmydir="/k8/appdir/info.k8.cn/data/attachment/portal/"$lastmonth
mydir="/z_data_back/shell/"$month
index="/index.html"
if [ -d $mydir ];then
mkdir $mydir$today
chmod 777 $mydir$today
touch $mydir$today$index
chmod 444 $mydir$today$index
else
mkdir $mydir
chmod 755 $mydir
touch $mydir$index
chmod 444 $mydir$index
mkdir $mydir$today
chmod 777 $mydir$today
touch $mydir$today$index
chmod 444 $mydir$today$index
fi
if [ -d $lastmydir$yestady ];then
chmod -R 755 $lastmydir$yestady
chmod 444 $lastmydir$yestady$index
fi
if [ $lastmonth -ne $month ];then
chmod 755 $lastmydir
fi