expect 运行脚本文件 执行postgres数据库操作

#!/bin/bash
/usr/bin/expect  << EOF
spawn /usr/local/pgsql/bin/2.sh
expect "*postgres:"
send "postgres\r"
set timeout 7200
expect eof
EOF

2.sh

#!/bin/bash /usr/local/pgsql/bin/psql -h 192.168.16.26 -p 5432 -U postgres -W -c "select delete_collection_data()" bigdata

 

posted @ 2019-09-23 13:54  侃豺小哥  阅读(524)  评论(0编辑  收藏  举报