daily script
This commit is contained in:
parent
3969f4ccd6
commit
54703a8825
11 changed files with 20 additions and 14 deletions
|
@ -9,8 +9,8 @@ web panel for proxmaster built with Flask
|
||||||
|
|
||||||
### setup panel:
|
### setup panel:
|
||||||
|
|
||||||
1. adduser USER
|
1. adduser proxadmin
|
||||||
2. cd /home/USER
|
2. cd /home/proxadmin
|
||||||
3. virtualenv -p python3 appserver
|
3. virtualenv -p python3 appserver
|
||||||
4. cd appserver
|
4. cd appserver
|
||||||
5. git clone git://github.com/kanaka/noVNC
|
5. git clone git://github.com/kanaka/noVNC
|
||||||
|
@ -18,4 +18,6 @@ web panel for proxmaster built with Flask
|
||||||
7. source bin/activate
|
7. source bin/activate
|
||||||
8. cd proxmaster-panel/ ; pip install -r requirements.txt
|
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
|
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
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ def activate(itemid=0):
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
if owner.is_administrator:
|
if owner.is_administrator:
|
||||||
return redirect(url_for('admin.list_items'))
|
return redirect(url_for('admin.list_services'))
|
||||||
else:
|
else:
|
||||||
return redirect(url_for('main.dashboard'))
|
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)
|
return render_template('smanager/activate.html', form=form, service=service, ppm=ppm, total=(ppm * service.period), currency=owner.currency)
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
<div class="panel-heading">Admin Pages</div>
|
<div class="panel-heading">Admin Pages</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<center>
|
<center>
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_deployments') }}','_self')"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Deployments</button>
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_deployments') }}','_self')"><span class="glyphicon glyphicon-hdd" aria-hidden="true"></span> Deployments</button>
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_addresses') }}','_self')"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Addresses</button>
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_addresses') }}','_self')"><span class="glyphicon glyphicon-tag" aria-hidden="true"></span> Addresses</button>
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_services') }}','_self')"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Services</button>
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_services') }}','_self')"><span class="glyphicon glyphicon-star" aria-hidden="true"></span> Services</button>
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_domains') }}','_self')"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Domains</button>
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_domains') }}','_self')"><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Domains</button>
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_users') }}','_self')"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Users</button>
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_users') }}','_self')"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Users</button>
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_transactions') }}','_self')"><span class="glyphicon glyphicon-usd" aria-hidden="true"></span> Transactions</button>
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_transactions') }}','_self')"><span class="glyphicon glyphicon-usd" aria-hidden="true"></span> Transactions</button>
|
||||||
<button class="btn btn-default" onclick="alert('Как ще си събираш зъбите със счупени ръце?')"><span class="glyphicon glyphicon-cd" aria-hidden="true"></span> Nothing</button>
|
<button class="btn btn-default" onclick="alert('Как ще си събираш зъбите със счупени ръце?')"><span class="glyphicon glyphicon-cd" aria-hidden="true"></span> Nothing</button>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{% include "admin/admin_tasks.html" %}
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-warning" id="addresses">
|
<div class="panel panel-info" id="addresses">
|
||||||
<div class="panel-heading">Addresses</div>
|
<div class="panel-heading">Addresses</div>
|
||||||
<div class="panel-body"><p>
|
<div class="panel-body"><p>
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{% include "admin/admin_tasks.html" %}
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-warning" id="deployments">
|
<div class="panel panel-info" id="deployments">
|
||||||
<div class="panel-heading">Deployments</div>
|
<div class="panel-heading">Deployments</div>
|
||||||
<div class="panel-body"><p>
|
<div class="panel-body"><p>
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{% include "admin/admin_tasks.html" %}
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-warning" id="domains">
|
<div class="panel panel-info" id="domains">
|
||||||
<div class="panel-heading">Domains</div>
|
<div class="panel-heading">Domains</div>
|
||||||
<div class="panel-body"><p>
|
<div class="panel-body"><p>
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{% include "admin/admin_tasks.html" %}
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-warning" id="services">
|
<div class="panel panel-info" id="services">
|
||||||
<div class="panel-heading">Services</div>
|
<div class="panel-heading">Services</div>
|
||||||
<div class="panel-body"><p>
|
<div class="panel-body"><p>
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{% include "admin/admin_tasks.html" %}
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-warning">
|
<div class="panel panel-info">
|
||||||
<div class="panel-heading">Transactions</div>
|
<div class="panel-heading">Transactions</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% include "admin/admin_tasks.html" %}
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-warning" id="users">
|
<div class="panel panel-info" id="users">
|
||||||
<div class="panel-heading">List Active Users</div>
|
<div class="panel-heading">List Active Users</div>
|
||||||
<div class="panel-body"><p>
|
<div class="panel-body"><p>
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
|
|
@ -168,7 +168,7 @@ def activate(itemid=0):
|
||||||
|
|
||||||
flash('Deployment {} activated for {} month(s)'.format(str(deploy.machine_alias), form.period.data))
|
flash('Deployment {} activated for {} month(s)'.format(str(deploy.machine_alias), form.period.data))
|
||||||
if owner.is_administrator:
|
if owner.is_administrator:
|
||||||
return redirect(url_for('admin.list_items'))
|
return redirect(url_for('admin.list_deployments'))
|
||||||
else:
|
else:
|
||||||
return redirect(url_for('main.dashboard'))
|
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)
|
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)
|
||||||
|
|
4
cronexec.sh
Executable file
4
cronexec.sh
Executable file
|
@ -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"
|
Loading…
Reference in a new issue