mdserver-web/plugins/pgadmin/pg_init.sh

30 lines
659 B
Bash
Raw Normal View History

2024-10-01 13:35:51 -04:00
#!/bin/bash
2024-10-01 13:26:26 -04:00
2024-10-01 13:35:51 -04:00
python_ver=`ls /www/server/pgadmin/run/lib/ | grep python | cut -d \ -f 1 | awk 'END {print}'`
2024-10-01 15:29:34 -04:00
email=$1
email_pwd=$2
2024-10-01 13:35:51 -04:00
expect <<-EOF
set time 10
2024-10-01 13:26:26 -04:00
spawn gunicorn --bind unix:/tmp/pgadmin4.sock \
--workers=1 \
--threads=25 \
2024-10-01 13:35:51 -04:00
--chdir /www/server/pgadmin/run/lib/${python_ver}/site-packages/pgadmin4 pgAdmin4:app
2024-10-01 13:26:26 -04:00
expect {
2024-10-01 15:29:34 -04:00
"Email address:" { send "${email}\r"; exp_continue }
"Password" { send "${email_pwd}\r"; exp_continue }
"Retype password" { send "${email_pwd}\r" }
2024-10-01 13:26:26 -04:00
}
expect eof
2024-10-01 13:35:51 -04:00
EOF
2024-10-01 13:49:19 -04:00
2026-05-07 06:47:45 -04:00
pids=$(ps -ef | grep 'pgAdmin4:app' | grep -v grep | awk '{print $2}')
2024-10-01 13:49:19 -04:00
arr=($pids)
for p in ${arr[@]}
do
kill -9 $p > /dev/null 2>&1
done
2024-10-01 13:56:26 -04:00