페이지

2014년 6월 15일 일요일

[sendmail]host map: lookup (gmail.com): deferred) 나올때 해결법

다음으로 sendmail처리과정 살펴본다
sendmail -v -d8.32 -qI<qid>

보통 네임서버 문제 이기때문에
/etc/resolv.conf에서 네임서버 설정


sendmail 재시작

shell 재시작(queue발송 데몬 별도로 뛰었을시)

2014년 5월 28일 수요일

[linux] 5분단위 파일만들기

#d=date +'%Y%m%d%H%M'
#insDate=`date --date='' '+%Y%m%d%H%M'`
insDate=`date '+%Y%m%d%H%M'`
insDateForDir=`date '+%Y%m%d'`

#echo ${insDate:10:3} 
strForMinute=${insDate:11:1}
echo "분단위 마지막 한 자리=> "  ${strForMinute}

lastDate=${insDate:0:11}
echo "11번째자리가지 자른 날자=>" ${lastDate}

fileNameForLstMinute=0


case "${strForMinute}" in
0)
        fileNameForLstMinute=0
        ;;
1)
        fileNameForLstMinute=0
        ;;
2)
        fileNameForLstMinute=0
        ;;
3)
        fileNameForLstMinute=0
        ;;
4)
        fileNameForLstMinute=0
        ;;
5)
        fileNameForLstMinute=5
        ;;
6)
        fileNameForLstMinute=5
        ;;
7)
        fileNameForLstMinute=5
        ;;
8)
        fileNameForLstMinute=5
        ;;
9)
        fileNameForLstMinute=5
        ;;
*)      echo "there is no value"
        ;;
esac

echo "가공된 분자리 =>" ${fileNameForLstMinute} 

lastDate=${lastDate}${fileNameForLstMinute}

echo "최종날자=>" ${lastDate}

serverNum="001"
serviceGubn="service"

#ohp
logDir="/logs/test/"${serviceGubn}"/"${insDateForDir}"/"                                                       
logFile="OHP."${serverNum}"."${lastDate}".log"                                                                    
logOhp=${logDir}${logFile}                                                                                        
mkdir -p -- "${logDir%/*}" && touch  ${logOhp}                                                                    
                                                                                                                  
echo ${logOhp} 

[postgresql] execute function in shell using crontab

1. register the account information

vi ~/.pgpass
localhost:portnumber:db_name:username:password

2. create shell script

vi shell.sh

#!/bin/sh

dbname="dbname"
username="username"

/opt/postgres/9.3/bin/psql $dbname $username<<EOF
select function_name();
EOF


3. register into the crontab

*/1 * * * * /home/shell/shell.sh > /log/errlog.log 2>&1

[altibase]execute altibase procedure every 1 minute using crontab

export ALTIBASE_HOME='/altibase/altibase_home'
export PATH=./:$PATH
ISQL="/altibase/altibase_home/bin/isql -s localhost -u user-p pass-port 20300"

${ISQL} << EOF
        exec PROC_NAME;
        quit
EOF

[linux] here-document at line 10 delimited by end-of-file (wanted `EOF')

remove any character before and after "EOF"

meaning remove all tabs, whitespaces, special characters etc. before and after the EOF,

[linux] when crontab does not working


  1. use absolute path
  2. check error message using following script
    1. */1 * * * * /test/test.sh > /tmp/test.log 2>&1
  3. set environmet variable in the script file





image

image