2019年11月11日 星期一

Online Carrefour

   <frameset cols="50%,*" rows="50%,*">
   <frame name="Web03" src="https://online.carrefour.com.tw:7113">
   <frame name="Web04" src="https://online.carrefour.com.tw:7114">
   <frame name="Web05" src="https://online.carrefour.com.tw:7115">
   <frame name="Web06" src="https://online.carrefour.com.tw:7116">

   </frameset>

2019年11月5日 星期二

Linux shell date

前一天

  • date -d '-1 days' +%F
  • date -d '-1 days' +%Y-%m-%d"

後一天

  • date -d '+1 days' +%F
  • date -d '+1 days' +%Y-%m-%d

1小時前

  • date -d '-1 hours' "+%Y-%m-%d %H:%M:%S"
  • date -d '-1 hours' "+%F %H:%M:%S"

1小時後

  • date -d '+1 hours' "+%Y-%m-%d %H:%M:%S"
  • date -d '+1 hours' "+%F %H:%M:%S"

1分鐘前

  • date -d '-1 minutes' "+%Y-%m-%d %H:%M:%S"
  • date -d '-1 minutes' "+%F %H:%M:%S"

1分鐘後

  • date -d '+1 minutes' "+%Y-%m-%d %H:%M:%S"
  • date -d '+1 minutes' "+%F %H:%M:%S"

1秒前

  • date -d '-1 seconds' "+%Y-%m-%d %H:%M:%S"
  • date -d '-1 seconds' "+%F %H:%M:%S"

1秒後

  • date -d '+1 seconds' "+%Y-%m-%d %H:%M:%S"
  • date -d '+1 seconds' "+%F %H:%M:%S"

Linux shell script expect

#!/bin/sh

DTIME=`date -d '1 days ago' "+%Y%m%d"`
TIMENOW=`date "+%Y-%m-%d"`
HOST="100.69.10.166"
USER="sftpuser"
PASS="p@ssw0rd"
PATH="/sftp/path/here"
LPATH="/home/hanzo"

sftpget(){
expect -c "
spawn sftp ${USER}@${HOST}
expect \"password: \"
send \"${PASS}\r\"
expect \"sftp>\"
send \"cd $PATH\r\"
expect \"sftp>\"
send \"lcd ${LPATH}\r\"
expect \"sftp>\"
send \"get P4ITM${DTIME}.TXT\r\"
expect \"sftp>\"
send \"get P4ITM${DTIME}.TRG\r\"
expect \"sftp>\"
send \"get P4ITS${DTIME}.TXT\r\"
expect \"sftp>\”
send \”get P4ITS${DTIME}.TRG\r\"
expect \"sftp>\”
send \”get P4ITB${DTIME}.TXT\r\"
expect \"sftp>\”
send \”get P4ITB${DTIME}.TRG\r\"
expect \"sftp>\”
send \”get P4OP${DTIME}.TXT\r\"
expect \"sftp>\”
send \”get P4OP${DTIME}.TRG\r\"
expect \"sftp>\”
send \"bye\r\"

expect \"#\"
"
}

smail(){
echo \"Hello World.\" | mutt -s \"hello world\" -a attachfile.txt -c hanzo.chen@gmail.com
}

case $1 in

get)

sftpget
;;

send)
smail
;;

*)
echo "Usage $0 {get|send}"
;;
esac