Add files via upload

This commit is contained in:
Mylloon 2020-08-03 19:44:29 +02:00 committed by GitHub
parent 757f0f283c
commit 3fc16ec5c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,7 @@
cd CHEMIN VERS LE BOT SUR LE SERV
docker build --tag ravabot:latest .
docker stop ravaBot
docker rm ravaBot
docker image prune --filter "label!=tag=python" --force
docker run --detach --restart unless-stopped --name ravaBot ravabot
docker exec -d ravaBot pip install --upgrade pip

View file

@ -0,0 +1,42 @@
LANCER UN NOUVEAU CONTAINER POSTGRESDL :
docker run -p PORT:PORT -d \
-e POSTGRES_PASSWORD=MOT_DE_PASSE \
-e POSTGRES_USER=USER \
-e POSTGRES_DB=NOM_DE_LA_BASE \
-v pgdata:/var/lib/postgresql/data \
postgres
docker run -p 5432:5432 \
--name NOM_DU_CONTAINER \
-e POSTGRES_PASSWORD=MOT_DE_PASSE -d \
-v /var/lib/postgresql/data \
postgres
SE CONNECTER A LA BASE DE DONNEE SQL : ("\q" pour quitter) DEPUIS DOCKER
psql ravabot -h localhost -U admin
DEPUIS OMV
docker exec -it NOM/ID_DU_CONTAINER psql -U admin ravabot
EDITER FICHIER CONF SQL :
nano /var/lib/docker/volumes/pgdata/_data/postgresql.conf
(1) METTRE LA BACKUP SUR LE SERV :
nano /var/lib/docker/volumes/pgdata/_data/backup.csv
(2) METTRE LA BACKUP SUR LA TABLE :
COPY users(id_user,dernier_message_xp_pics,experience) FROM 'backup.csv' DELIMITER ',' CSV HEADER;
VIDER TABLE USER:
DELETE FROM users RETURNING *;
VOIR TABLE USER:
SELECT * FROM users;

1
UPDATE RAVABOT/save.txt Normal file
View file

@ -0,0 +1 @@
.~-2

58
UPDATE RAVABOT/update.bat Normal file
View file

@ -0,0 +1,58 @@
@echo off
for /f "delims=" %%a in (save.txt) do set lasttimetaken=%%a
chcp 28591 > nul
echo Appuyez sur n'importe quel touche pour lancer le push (dernière exécution en %lasttimetaken%sec.)
echo.
set starttime=%TIME%
set startcsec=%STARTTIME:~9,2%
set startsecs=%STARTTIME:~6,2%
set startmins=%STARTTIME:~3,2%
set starthour=%STARTTIME:~0,2%
set /a starttime=(%starthour%*60*60*100)+(%startmins%*60*100)+(%startsecs%*100)+(%startcsec%)
cd C:\Program Files\PuTTY
plink.exe -ssh USER@NOM_PRESET -P PORT -pw USER -m "C:\....chemin....\commandupdate.txt"
set endtime=%time%
set endcsec=%endTIME:~9,2%
set endsecs=%endTIME:~6,2%
set endmins=%endTIME:~3,2%
set endhour=%endTIME:~0,2%
if %endhour% LSS %starthour% set /a endhour+=24
set /a endtime=(%endhour%*60*60*100)+(%endmins%*60*100)+(%endsecs%*100)+(%endcsec%)
set /a timetaken= ( %endtime% - %starttime% )
set /a timetakens= %timetaken% / 100
set timetaken=%timetakens%.%timetaken:~-2%
cd "C:\....chemin....\UPDATE RAVABOT"
echo %timetaken% > save.txt
echo.
set /a timetaken=%timetaken% + 5
for %%d in (%timetaken%) do call :duration %%d
pause
exit/b 0
:duration
set output=
set /a "wk=%1/604800,rem=%1%%604800"
if %wk% neq 0 set "output= %wk% sem,"
set /a "d=%rem%/86400,rem=%rem%%%86400"
if %d% neq 0 set "output=%output% %d% j"
set /a "hr=%rem%/3600,rem=%rem%%%3600"
if %hr% neq 0 set "output=%output% %hr% h"
set /a "min=%rem%/60,rem=%rem%%%60"
if %min% neq 0 set "output=%output% %min% min"
if %rem% neq 0 set "output=%output% %rem% sec"
if %1 gtr 0 echo Exécution en %output%.
goto :EOF