From 54703a882500ef9f38234e4ce20f9da4f8dca267 Mon Sep 17 00:00:00 2001 From: deflax Date: Tue, 25 Jul 2017 17:33:23 +0300 Subject: [PATCH] daily script --- README.md | 6 ++++-- app/smanager/routes.py | 2 +- app/templates/admin/admin_tasks.html | 8 ++++---- app/templates/admin/list_addresses.html | 2 +- app/templates/admin/list_deployments.html | 2 +- app/templates/admin/list_domains.html | 2 +- app/templates/admin/list_services.html | 2 +- app/templates/admin/list_transactions.html | 2 +- app/templates/admin/list_users.html | 2 +- app/vmanager/routes.py | 2 +- cronexec.sh | 4 ++++ 11 files changed, 20 insertions(+), 14 deletions(-) create mode 100755 cronexec.sh diff --git a/README.md b/README.md index 37227ab..5a52dec 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ web panel for proxmaster built with Flask ### setup panel: -1. adduser USER -2. cd /home/USER +1. adduser proxadmin +2. cd /home/proxadmin 3. virtualenv -p python3 appserver 4. cd appserver 5. git clone git://github.com/kanaka/noVNC @@ -18,4 +18,6 @@ web panel for proxmaster built with Flask 7. source bin/activate 8. cd proxmaster-panel/ ; pip install -r requirements.txt 9. python3 manage.py db init ; python3 manage.py db migrate -m "init" ; python3 manage.py db upgrade ; python3 manage.py deploy +10. chmod +x /home/proxadmin/appserver/proxadmin/cronexec.sh +11. add "00 09 * * * root /home/proxadmin/appserver/proxadmin/cronexec.sh" to /etc/crontab diff --git a/app/smanager/routes.py b/app/smanager/routes.py index 3b79b4c..e449863 100644 --- a/app/smanager/routes.py +++ b/app/smanager/routes.py @@ -64,7 +64,7 @@ def activate(itemid=0): db.session.commit() if owner.is_administrator: - return redirect(url_for('admin.list_items')) + return redirect(url_for('admin.list_services')) else: return redirect(url_for('main.dashboard')) return render_template('smanager/activate.html', form=form, service=service, ppm=ppm, total=(ppm * service.period), currency=owner.currency) diff --git a/app/templates/admin/admin_tasks.html b/app/templates/admin/admin_tasks.html index 10284cb..76d56fa 100644 --- a/app/templates/admin/admin_tasks.html +++ b/app/templates/admin/admin_tasks.html @@ -3,10 +3,10 @@
Admin Pages
- - - - + + + + diff --git a/app/templates/admin/list_addresses.html b/app/templates/admin/list_addresses.html index 5d46785..c397fff 100644 --- a/app/templates/admin/list_addresses.html +++ b/app/templates/admin/list_addresses.html @@ -10,7 +10,7 @@ {% include "admin/admin_tasks.html" %}
-
+
Addresses

diff --git a/app/templates/admin/list_deployments.html b/app/templates/admin/list_deployments.html index 93d087a..74b7869 100644 --- a/app/templates/admin/list_deployments.html +++ b/app/templates/admin/list_deployments.html @@ -10,7 +10,7 @@ {% include "admin/admin_tasks.html" %}
-
+
Deployments

diff --git a/app/templates/admin/list_domains.html b/app/templates/admin/list_domains.html index 327e863..9be832c 100644 --- a/app/templates/admin/list_domains.html +++ b/app/templates/admin/list_domains.html @@ -10,7 +10,7 @@ {% include "admin/admin_tasks.html" %}
-
+
Domains

diff --git a/app/templates/admin/list_services.html b/app/templates/admin/list_services.html index 5c5f7f8..92b4255 100644 --- a/app/templates/admin/list_services.html +++ b/app/templates/admin/list_services.html @@ -10,7 +10,7 @@ {% include "admin/admin_tasks.html" %}
-
+
Services

diff --git a/app/templates/admin/list_transactions.html b/app/templates/admin/list_transactions.html index a49cf1a..faf8ca4 100644 --- a/app/templates/admin/list_transactions.html +++ b/app/templates/admin/list_transactions.html @@ -6,7 +6,7 @@ {% include "admin/admin_tasks.html" %}
-
+
Transactions
diff --git a/app/templates/admin/list_users.html b/app/templates/admin/list_users.html index 74e0f88..0f414fe 100644 --- a/app/templates/admin/list_users.html +++ b/app/templates/admin/list_users.html @@ -5,7 +5,7 @@ {% include "admin/admin_tasks.html" %}
-
+
List Active Users

diff --git a/app/vmanager/routes.py b/app/vmanager/routes.py index a93ef8c..95c6f83 100644 --- a/app/vmanager/routes.py +++ b/app/vmanager/routes.py @@ -168,7 +168,7 @@ def activate(itemid=0): flash('Deployment {} activated for {} month(s)'.format(str(deploy.machine_alias), form.period.data)) if owner.is_administrator: - return redirect(url_for('admin.list_items')) + return redirect(url_for('admin.list_deployments')) else: return redirect(url_for('main.dashboard')) return render_template('vmanager/activate.html', form=form, deploy=deploy, cpu_cost=cpu_cost, mem_cost=mem_cost, hdd_cost=hdd_cost, ppm=ppm, total=(ppm * deploy.period), currency=owner.currency) diff --git a/cronexec.sh b/cronexec.sh new file mode 100755 index 0000000..1fed76b --- /dev/null +++ b/cronexec.sh @@ -0,0 +1,4 @@ +#!/bin/bash +scriptdir=`dirname $0` +cd $scriptdir +/bin/bash -c "source ../bin/activate; python3 manage.py autodisable ; python3 manage.py autowarn"