페이지

2014년 5월 28일 수요일

[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

댓글 없음:

댓글 쓰기

image

image