#!/bin/bash
cd `dirname $0`
now_weekday=`date "+%u"`
output="/var/log/yama/ssl_check.txt"

echo "$now_weekday Start"   > $output
# sunday
if [ $now_weekday -eq 0 ];then
  echo "frey.norn-norm.work check!!"   >> $output 
  ./letsencrypt_frey.sh   >> $output 2>&1
  echo "thor.norn-norm.work check!!"   >> $output 
  ./letsencrypt_thor.sh   >> $output 2>&1
fi

# monday
if [ $now_weekday -eq 1 ];then
 echo "gaia.norn-norm.work check!!" > $output
 /home/yama/bin/letsencrypt_gaia.sh > $output 2>&1
fi

# tuesday
if [ $now_weekday -eq 2 ];then
  echo "north.norn-norm.work check!!"   >> $output
  ./letsencrypt_north.sh   >> $output 2>&1 
  echo "mail.norn-norm.work check!!"   >> $output
  ./letsencrypt_mail.sh   >> $output 2>&1 
fi

# wedenesday
if [ $now_weekday -eq 3 ];then
  echo "www.norn-norm.work check!!" >> $output
  ./letsencrypt_www.sh >> $output 2>&1
  echo "valc.norn-norm.work check!!" >> $output
  ./letsencrypt_valac.sh >> $output 2>&1
fi

# thursday
if [ $now_weekday -eq 4 ];then
 echo "sabnach.norn-norm.work check!!" > $output
 /home/yama/bin/letsencrypt_sabnach.sh > $output 2>&1
fi
#saturday
if [ $now_weekday -eq 6 ];then
 echo "norn.norn-norm.work check!!"   >> $output 
 ./letsencrypt_norn.sh   >> $output 2>&1
fi
