[jboss@yellow moms]$ crontab -e
#mom's
15 01 * * * cd /home/jboss/moms;sh momsdiary.sh <id> <pwd>
[jboss@yellow moms]$ cat momsdiary.sh
#!/bin/bash +
if [ $# -ne 2 ] ; then
echo "Usage: $0 <id> <passwd>"
exit 1
fi
LOG_DIR=./logs/$(date +'%Y%m')
mkdir -p $LOG_DIR
USERID=$1
PASSWD=$2
touch "$LOG_DIR/$(date +%Y%m%d%H%M%S).start"
POST_DATA="id=$USERID&password=$PASSWD"
set +
wget \
--user-agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" \
--keep-session-cookies \
--save-cookie cookie \
--post-data $POST_DATA \
--secure-protocol=SSLv2 \
--no-check-certificate \
-o result.momsdiary.co.kr.system \
-O result.momsdiary.co.kr.out \
https://secure.momsdiary.co.kr/member/login.php
HTTP_RESULT=`grep '200 OK' result.momsdiary.co.kr.system | awk '{print $6}'`
echo $HTTP_RESULT
if [ "e200" != "e$HTTP_RESULT" ] ; then
touch "$LOG_DIR/$(date +%Y%m%d%H%M%S).error"
rm result.*
exit 1;
fi
YEAR=`date +'%Y'`
MONTH=`date +'%m'`
DAY=`date +'%d'`
POST_DATA="mlog_id=$USERID®_date=$YEAR-$MONTH-$DAY&vtype=&mode=write&diary_kind=1&category=01&diary_year=$YEAR&diary_month=$MONTH&diary_day=$DAY&weather=09&emoticon=10&title=$YEAR/$MONTH/$DAY diary&align=left&comment=$YEAR/$MONTH/$DAY diary&open=0&best=0&picture=&x=0&y=0
"
wget \
--user-agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" \
--load-cookies cookie \
--post-data "$POST_DATA" \
--referer="http://mlog.momsdiary.co.kr/mydiary/diary/index.html?mlog_id=badagi&mode=write" \
-o result.data1.momsdiary.co.kr.system \
-O result.data1.momsdiary.co.kr.out \
http://data1.momsdiary.co.kr/mydiary/diary/diary_act_2011.php
rm result.*
touch "$LOG_DIR/$(date +%Y%m%d%H%M%S).done"
'개발 > 기타' 카테고리의 다른 글
[기타] XSS , SQL Inject (0) | 2013.01.07 |
---|---|
[Amazon] EC2 Region 간 복사 (0) | 2012.08.02 |
[JAVA] JBOSS SSL 사설 인증서 (0) | 2012.03.18 |
[기타] How To Enable “Click To Play” For Plug-ins And Flash In Google Chrome (0) | 2012.01.09 |
[기타] VMWare SCSI warning message 해결 방법 (0) | 2011.11.23 |