pull/624/head
Mr Chen 7 months ago
parent 0c7773c6d4
commit 45f51954f9
  1. 8
      plugins/pgadmin/index.py
  2. 9
      plugins/pgadmin/pg_init.sh

@ -203,10 +203,16 @@ def initReplace():
setCfg('password', password)
mw.writeFile(pass_path, pass_cmd)
# pg_conf = getCfg()
judge_file = getServerDir()+'/data/pgadmin4/pgadmin4.db'
if not os.path.exists(judge_file):
pg_init_bash = getPluginDir()+'/pg_init.sh'
t = mw.execShell("bash "+pg_init_bash)
pg_rand = mw.getRandomString(8)
pg_username = "mw."+pg_rand+"@gmail.com"
setCfg('web_pg_password', pg_username)
pg_password = mw.getRandomString(10)
setCfg('web_pg_password', pg_password)
t = mw.execShell("bash "+ pg_init_bash + " " + pg_username + " " + pg_password)
# print(t)
# systemd

@ -2,6 +2,9 @@
python_ver=`ls /www/server/pgadmin/run/lib/ | grep python | cut -d \ -f 1 | awk 'END {print}'`
email=$1
email_pwd=$2
expect <<-EOF
set time 10
spawn gunicorn --bind unix:/tmp/pgadmin4.sock \
@ -9,9 +12,9 @@ spawn gunicorn --bind unix:/tmp/pgadmin4.sock \
--threads=25 \
--chdir /www/server/pgadmin/run/lib/${python_ver}/site-packages/pgadmin4 pgAdmin4:app
expect {
"Email address:" { send "mdserver-web@gmail.com\r"; exp_continue }
"Password" { send "123123\r"; exp_continue }
"Retype password" { send "123123\r" }
"Email address:" { send "${email}\r"; exp_continue }
"Password" { send "${email_pwd}\r"; exp_continue }
"Retype password" { send "${email_pwd}\r" }
}
expect eof
EOF

Loading…
Cancel
Save