[ { "taaknaam": "00. Presentatie Django", "taaktext": "

Django

\r\n\r\n

Wat ?      compleet en open source raamwerk voor webapplicaties dmv Python MVT - MVC raamwerk  (Model-View-Controller)

\r\n\r\n

Django is een professioneel raamwerk om internet applicaties mee te bouwen.
\r\nZeker bij complexe applicaties zorgt Django er voor dat het relatief eenvoudig is om snel met resultaten te komen.
\r\nHet mooie is dat belangrijke basisfunctionaliteiten zoals bijvoorbeeld inloggen en registreren al in een app zitten en het eenvoudig wordt om uit te breiden naar uw wensen.

\r\n\r\n

Django of Laravel: Welk framework is het beste in 2022 ? zie https://kinsta.com/nl/blog/django-of-laravel/#django-en-laravel-welk-framework-is-beter-voor-webdevelopment

\r\n\r\n

Django heeft het MVT design structuur ! zie https://www.geeksforgeeks.org/django-project-mvt-structure/ 

\r\n\r\n

2005 : World Online (krant VS)  ontwikkelaars Adrian Holovaty en  Willison Simon samen met ,Jacob Kaplan-Mosse, Wilson Miner
\r\nPHP gedumpt en Python werd gebruikt  voor ontwikkelen van websites ; succes met Lawrence.com  
\r\nopen-source software Django  genoemd naar Django Reinhardt (in België geboren als Jean Reinhardt 1910-1953 een gipsy jazz muzikant)  daar Adrian Holovaty een Am muzikant van jazz , woont nu in Amsterdam... 

\r\n\r\n

Django Reinhardt

\r\n\r\n

sedert  1,5 jaar enorm succes ... ,  nu al aan versie 3.0 (april 3.1, dec 3.2 en eind 2021  4.0)
\r\nMVC raamwerk 
\r\nMVC (Model-View-Controller)
\r\nWat is MVC?
\r\nMVC is een software-architectuur ontwerppatroon . Het verdeelt of scheidt uw app in drie delen:
\r\nModel: verantwoordelijk voor gegevensopslag en -beheer,
\r\nView = weergave: verantwoordelijk voor het weergeven en weergeven van de gebruikersinterface
\r\nController: verantwoordelijk voor de afhandeling van logica om de gebruikersinterface te besturen en met het datamodel te werken.

\r\n\r\n

MVT structuur: 

\r\n\r\n

\"\"
\r\nmodel : waar we onze gegevens plaatsen : foto's , video's, titels, namen, beschrijvingen ... datums
\r\nview : hoe je website de gegevens krijgt van onze modellen en voor de gebruikers verwerkt.
\r\ntemplate : de weergave van de gegevens op de website. Bestaande Tools HTML, CSS en Javascript

\r\n\r\n

\"\"

\r\n\r\n\r\n\r\n

\"\"

\r\n\r\n

standaard worden een aantal apps automatisch toegevoegd aan het Django Project

\r\n\r\n\r\n\r\n

het mooie is : een app is herbruikbaar , je kunt dezelfde app in meerdere projecten gebruiken
\r\niedere app : admin.py, models.py, views.py en urls.py (meestal)

\r\n\r\n

Django ORM

\r\n\r\n

object-relational mapper 

\r\n\r\n

Django Model : beschrijft je tabel van je database records (in models.py)

\r\n\r\n

eenvoudige manipulatie van je gegevens zonder complexe SQL re moeten schrijven
\r\nIn de meeste gevallen worden er relaties gelegd tussen je gegevens

\r\n\r\n

een op een (OnetoOne) één op veel relatie (OnetoMany) ; veel op veel relatie (ManyToMany)

\r\n\r\n

\"\"

\r\n\r\n

Django maakt automatisch je tabellen en indexen in je database

\r\n\r\n

Django biedt 4 basisdatabasefuncties : Creëren, lezen, bijwerken en verwijderen

\r\n\r\n

    CRUD : Create, Read, Update en Delete

\r\n\r\n

Django API

\r\n\r\n

    python API   .... application program interface : data in  XML formaat of JSON (Java Script Object Notation) formaat 

\r\n\r\n

Django Shell

\r\n\r\n

    python manage.py shell

\r\n\r\n

Django admin

\r\n\r\n

    automatisch gegenereerde admin functie

\r\n\r\n

Django SQL database

\r\n\r\n

    een eenvoudige database kan gebruikt worden :  SQLITE3.

\r\n\r\n

    Alsook MySQL, MariaDB , PostgreSQL  Oracle, ...  kan gebruikt worden.

\r\n\r\n

Django ondersteuning internationalizering  i18n en ondersteuning verschillende tijdzones

\r\n\r\n

    webtoepassingen in andere talen : spellingscontrole in het Nederlands

\r\n\r\n

    tijdzones : nul meridiaan van Greenwich = UTC

\r\n\r\n

        wij : UTC + 1

\r\n\r\n

paginering instellen voor lijst

\r\n\r\n

    zie 20 postcodes per pagina ipv 50

\r\n\r\n

django website

\r\n\r\n

    django overzicht

\r\n\r\n

django uitgebreide documentatie

\r\n\r\n

    django documentatie 4.0

\r\n\r\n

    in pdf formaat : doc in pdf formaat 

\r\n\r\n

python

\r\n\r\n

    python beschikt over  zeer uitgebreide pakketten , je moet hier het wiel niet terug uitvinden meestal zal je hier gebruik kunnen maken van reeds geschreven software

\r\n\r\n

    voorbeeld : als de webcam van je laptop wilt gebruiken om qrcodes of streepjescode wilt scannen dan kun je bestaande speciale python pakketten hiervoor gebruiken !

\r\n\r\n

    python taak

\r\n\r\n

database

\r\n\r\n

    standaard SQLITE3   documentatie : sqlite3 documentatie

\r\n\r\n

    andere database : MySQL, PostgreSQL, ORACLE, SAP, IBM_DB2, ODBC

\r\n\r\n

populaire websites dat django gebruiken

\r\n\r\n

    meest populaire django websites

\r\n\r\n\r\n\r\n

widgets

\r\n\r\n

    allerlei formulier widgets zijn mogelijk : 'TextInput', 'NumberInput', 'EmailInput', 'URLInput', 'PasswordInput', 'HiddenInput', 'MultipleHiddenInput', 'FileInput', 'ClearableFileInput', 'Textarea',     'DateInput', 'DateTimeInput', 'TimeInput', 'CheckboxInput', ...

\r\n\r\n

kalender

\r\n\r\n

    bij een datum veld , klik en er komt een maandkalender te voorschijn

\r\n\r\n

    scrolbaar per dag, maand en jaar

\r\n\r\n

html ckeditor

\r\n\r\n\r\n\r\n

ckeditor

\r\n\r\n

mijn django projecten

\r\n\r\n\r\n\r\n

maak gebruik van een virtuele omgeving

\r\n\r\n

    voordeel : onafhankelijk van nieuwere software

\r\n\r\n

    verschillende tools voor een virtuele omgeving

\r\n\r\n\r\n\r\n

starten django project

\r\n\r\n

django-admin startproject naamproject

\r\n\r\n

starten app binnen een django project

\r\n\r\n

python manage.py startapp naamapp

\r\n\r\n

createsuperuser

\r\n\r\n

python manage.py createsuperuser

\r\n\r\n

opzet Modellen

\r\n\r\n

    models.py
\r\n    python manage.py makemigrations
\r\n    python manage.py migrate

\r\n\r\n

starten django site

\r\n\r\n

python manage.py runserver 
\r\nhttp://127.0.0.1:8000 toont het django raamwerk
\r\nhttp://127.0.0.1:8000/admin toont het django raamwerk in admin mode

\r\n\r\n

http status codes

\r\n\r\n

http status codes    

\r\n\r\n

templates

\r\n\r\n

django template language DTL

\r\n\r\n

bootstrap 4.5.0 : zie bootstrap4 tutorial w3schools

\r\n\r\n

    Voordelen van Bootstrap:    
\r\n    Eenvoudig in gebruik: iedereen met alleen basiskennis van HTML en CSS kan Bootstrap gaan gebruiken
\r\n    Responsieve functies: de CSS van Bootstrap past zich aan op smartphones, tablets en desktops
\r\n    Mobile benadering: in Bootstrap : stijlen maken deel uit van het kernraamwerk
\r\n    Browsercompatibiliteit: Bootstrap 4 is compatibel met alle moderne browsers (Chrome, Firefox, Internet Explorer 10+, Edge, Safari en Opera)    

\r\n\r\n

nieuw bootstrap 5.0

\r\n\r\n

 

", "db_count": 278 }, { "taaknaam": "01. Django project adressenproject", "taaktext": "

adressenproject

\r\n\r\n

schema

\r\n\r\n

\"\"

\r\n\r\n

\"\"schema volgens django-extensions met manage.py graph_models 

\r\n\r\n

 

\r\n\r\n

 

\r\n\r\n

adres

\r\n\r\n

\"\"

\r\n\r\n

auth

\r\n\r\n

\"\"

\r\n\r\n

all

\r\n\r\n

\"\"

\r\n\r\n

paginering

\r\n\r\n

    postcode lijst : zie views.py class PostcodeListView : paginate_by = 50

\r\n\r\n

        57 paginas van telkens 50 postcodes : 56 * 50 + 25 = 2825 ; uitgenomen laatste pagina 

\r\n\r\n

        indien paginering op 30 ipv 50 :    95 paginas van telkens 30 postcodes : 94 * 30 + 5 = 2825

\r\n\r\n

views.py

\r\n\r\n

    ListView's : simpel

\r\n\r\n

PersoonListView, AdresListView, EmailListView,  TelefoonListView, PostcodeListView

\r\n\r\n

    model= , template_name=, paginate_by=

\r\n\r\n

    DetailView's : simpel

\r\n\r\n

            PersoonDetailView, AdresDetailView, EmailDetailView, TelefoonDetailView, PostcodeDetailView

\r\n\r\n

                template_name= 

\r\n\r\n

                def get_object(self): .....

\r\n\r\n

                (PersoonDetailView iets ingewikkelder daar naast Persoon ook zijn Adres, Email en Telefoon moet getoond worden

\r\n\r\n

    CreateView's : simpel

\r\n\r\n

            PersoonCreate, AdresCreate, EmailCreate, TelefoonCreate 

\r\n\r\n

    UpdateView's : simpel

\r\n\r\n

            PersoonUpdate, AdresUpdate, EmailUpdate, TelefoonUpdate, PostcodeUpdate

\r\n\r\n

    DeleteView's : simpel

\r\n\r\n

            PersoonDelete, AdresDelete, EmailDelete, TelefoonDelete

\r\n\r\n

     Zoek TemplateView's

\r\n\r\n

    Create2                    

\r\n\r\n

 

\r\n\r\n

index.html

\r\n\r\n

    Welkom op de Adressen administratie site, ontwikkelt met de modernste skeleton web framework = Django.
\r\n    Met Django is het mogelijk om vlugger en met minder code Website applicaties te maken.
\r\n    Het maakt gebruik van het MVC ontwerppatroon : complexe toepassingen worden ontworpen in drie eenheden = M(Model)-V(View)-C(Controller).
\r\n    Het datamodel zit in het Model, de datapresentatie in het View en de applicatielogica in de Controller.
\r\n    Het scheiden van deze verantwoordelijkheden bevordert de leesbaarheid en herbruikbaarheid van code.    

\r\n\r\n

    Het maakt ook dat bijvoorbeeld veranderingen in de gebruikersinterface niet direct invloed hebben op  het datamodel en vice versa.
\r\n    Het maakt gebruik van de serverloze Sqlite database dmv. de Python programmeertaal.

\r\n\r\n

    De Django Documentatie kun je vinden op Django doc versie 3.0 .

\r\n\r\n

 

\r\n\r\n

 

\r\n\r\n

 

\r\n\r\n

 

\r\n\r\n

 

\r\n\r\n

 

", "db_count": 186 }, { "taaknaam": "02. Django project takenproject", "taaktext": "

takenproject

\r\n\r\n

schema

\r\n\r\n

\"\"

\r\n\r\n

\"\"

\r\n\r\n

\"\"

\r\n\r\n

\"\"

\r\n\r\n

 

\r\n\r\n

\"\"

\r\n\r\n

db_count is een intern tellertje dat bijhoudt hoeveel maal een welbepaalde taak bekeken is.

\r\n\r\n

 

", "db_count": 174 }, { "taaknaam": "03. Django project cgcproject", "taaktext": "

cgcproject

\r\n\r\n\r\n\r\n

\"\"

\r\n\r\n

\"\"

\r\n\r\n\r\n\r\n

wijzig een cgclid / creëer een nieuw cgclid vereist Log in

\r\n\r\n

enkel de staff gebruiker kan alles en is zogenaamde administrator van dit cgcproject

\r\n\r\n

eerst andere gebruikers creëren

\r\n\r\n

Signup functie

\r\n\r\n

test_persoon1 J01Bizet_1
\r\ntest_persoon2 J01Bizet_2
\r\ntest_persoon3 J01Bizet_3
\r\ntweemaal signup met test_persoon1 gaat niet

\r\n\r\n

django admin functie : http://127.0.0.4:8000/admin

\r\n\r\n

test_persoon1, 2 en 3 geen toegang

\r\n\r\n

enkel administrator ulefr01 (staff gebruiker) : staff status en superuser status

\r\n\r\n

soorten toegang : add(=toevoegen), change(=wijzigen), delete (=weggooien) en view (=bekijken)
\r\nNOOT = view laten we hier toe

\r\n\r\n

test_persoon1 :

\r\n\r\n

voeg email adres toe

\r\n\r\n

met toegang add_cgclid, change_cgclid, delete_cgclid en view_cgclid

\r\n\r\n

test_persoon2 :

\r\n\r\n

met toegang change_cgclid en view_cgclid

\r\n\r\n

test_persoon3 :

\r\n\r\n

met toegang add_adres, change_adres, delete_adres en view_cgclid
\r\n(geen add_cgclid, change_cgclid, delete_cgclid !)

\r\n\r\n

creëer nieuwe cgcleden, wijzig cgcleden, delete cgcleden, nieuw adres, nieuwe vergadering gebruik hiervoor de verschillende test_persoon1, 2 en 3 gebruikers

\r\n\r\n

wijzig wachtwoord

\r\n\r\n

                  doe volgende tests

\r\n\r\n

gebruik ulefr01, check registraties op 18 mei 2019
\r\nwijzig vergadering 18 mei 2019

\r\n\r\n

wijzig datum naar 17 mei 2019
\r\nverzenden

\r\n\r\n

bekijk nu registraties : registraties op 18 mei zijn gewijzigd naar 17 mei : sql werkt goed !
\r\nwijzig datum terug naar 18-05-2019

\r\n\r\n

bekijk vergadering van 11 januari 2020
\r\nbekijk vergadering van 14 december 2019

\r\n\r\n\r\n\r\n

scannen streepjescodes/qrcodes met webcam van laptop : ./scanner.py

\r\n\r\n

De reguliere regressie van de CGC lidcodes moet voldoen aan re.match("^[A-Z]{2}/[0-9]{2}/[0-9]{2}")

\r\n\r\n\r\n\r\n

cat registraties_2019-09-10.txt | sort -u >registraties_2019-09-10.csv

\r\n\r\n\r\n\r\n

vereist : vergadering met registratie datum moet gecreerd zijn in de sql database
\r\npython opladen_aanwezigen.py -h 
\r\n    * opladen_aanwezigen.py -b <database> -d <datum> in formaat=yyyy-mm-dd
\r\npython opladen_aanwezigen.py -b db.sqlite3 -d 2019-10-12
\r\n    * datum is =  2019-10-12
\r\n    * database is =  db.sqlite3
\r\n    * vergadid = 11
\r\n    * filenaam =  registraties_2019-10-12.csv

\r\n\r\n\r\n\r\n

                  grafische presentatie van aanwezigen met de python matplotlib tool

\r\n\r\n

                  het plotten gebeurt met de "fivethirtyeight" stijl , het totaal aantal CGCleden worden getoond per per datum van de CGC vergadering 

\r\n\r\n\r\n\r\n

python qrcode.py "TE/01/01" test.qrcode.png

\r\n\r\n\r\n\r\n

zbarimg stevens.qrcode.png

\r\n\r\n\r\n\r\n

./backup_registraties

\r\n\r\n\r\n\r\n

./backup_database
\r\n    output is sqlite3_20191013.db

\r\n\r\n

 

\r\n\r\n

 

", "db_count": 168 }, { "taaknaam": "04. Django project weerproject", "taaktext": "

weerproject

\r\n\r\n

schema

\r\n\r\n

\"\"

\r\n\r\n

op het internet wordt data uitgewisselt over het web, meestal wordt het JSON formaat (Java Script Object Notering) gebruikt om gegevens door te spelen  

\r\n\r\n

weer API met parameters q = stad, units = metric en lang = nl voor nederlands met API key

\r\n\r\n

curl -s 'http://api.openweathermap.org/data/2.5/weather?q=Deerlijk&units=metric&lang=nl&appid=5cf01f009b7d0178a211d460f3ac67d7' | jq

\r\n\r\n

Indien Http-response = 200 dan is de stad gevonden met de accuweather API 

\r\n\r\n

Indien Http-response <> 200 dan is de stad niet gevonden en wordt de foutboodschap : "Stad bestaat niet in deze wereld !" getoond en wordt er geen nieuwe stad ind dedatabase gecreeerd.

\r\n\r\n

Indien Stad al in de database zit dan wordt de boodschap : "Stad bestaat reeds in de database !" getoond en wordt er geen nieuwe stad ind dedatabase gecreeerd.

\r\n\r\n

Per stad worden de temperatuur, beschrijving, een icoon, de tijdzone en het land getoond.

\r\n\r\n

Het json formaat van de gevonden API wordt getoond bij het opstarten van de website.

\r\n\r\n

Stad Sydney

\r\n\r\n

{'coord': {'lon': 151.21, 'lat': -33.87}, 'weather': [{'id': 500, 'main': 'Rain', 'description': 'lichte regen', 'icon': '10d'}], 'base': 'stations', 'main': {'temp': 15.18, 'feels_like': 13.66, 'temp_min': 12.78, 'temp_max': 17, 'pressure': 1022, 'humidity': 88}, 'visibility': 10000, 'wind': {'speed': 3.6, 'deg': 230}, 'rain': {'1h': 0.25}, 'clouds': {'all': 40}, 'dt': 1587934106, 'sys': {'type': 1, 'id': 9600, 'country': 'AU', 'sunrise': 1587932796, 'sunset': 1587971924}, 'timezone': 36000, 'id': 2147714, 'name': 'Sydney', 'cod': 200}
\r\n{'stad': <Stad: Sydney>, 'temperatuur': 15.18, 'beschrijving': 'lichte regen', 'icoon': '10d', 'tijdzone': 'UTC+10u', 'land': 'AU'}

\r\n\r\n

Stad Tokyo

\r\n\r\n

{'coord': {'lon': 139.69, 'lat': 35.69}, 'weather': [{'id': 803, 'main': 'Clouds', 'description': 'zwaar bewolkt', 'icon': '04d'}], 'base': 'stations', 'main': {'temp': 13, 'feels_like': 10.58, 'temp_min': 12.22, 'temp_max': 13.33, 'pressure': 1015, 'humidity': 76}, 'visibility': 10000, 'wind': {'speed': 3.1, 'deg': 30}, 'clouds': {'all': 75}, 'dt': 1587934150, 'sys': {'type': 1, 'id': 8074, 'country': 'JP', 'sunrise': 1587930817, 'sunset': 1587979431}, 'timezone': 32400, 'id': 1850144, 'name': 'Tokyo', 'cod': 200}
\r\n{'stad': <Stad: Tokyo>, 'temperatuur': 13, 'beschrijving': 'zwaar bewolkt', 'icoon': '04d', 'tijdzone': 'UTC+9u', 'land': 'JP'}

\r\n 

\r\n\r\n

Stad Wellington

\r\n\r\n

{'coord': {'lon': 174.78, 'lat': -41.29}, 'weather': [{'id': 804, 'main': 'Clouds', 'description': 'geheel bewolkt', 'icon': '04d'}], 'base': 'stations', 'main': {'temp': 15.2, 'feels_like': 8.72, 'temp_min': 14.44, 'temp_max': 16, 'pressure': 1016, 'humidity': 77}, 'visibility': 10000, 'wind': {'speed': 9.8, 'deg': 360, 'gust': 15.4}, 'clouds': {'all': 97}, 'dt': 1587934258, 'sys': {'type': 1, 'id': 7358, 'country': 'NZ', 'sunrise': 1587927821, 'sunset': 1587965587}, 'timezone': 43200, 'id': 2179537, 'name': 'Wellington', 'cod': 200}
\r\n{'stad': <Stad: Wellington>, 'temperatuur': 15.2, 'beschrijving': 'geheel bewolkt', 'icoon': '04d', 'tijdzone': 'UTC+12u', 'land': 'NZ'}

\r\n 

\r\n\r\n

Stad Zulte

\r\n\r\n

{'coord': {'lon': 3.45, 'lat': 50.92}, 'weather': [{'id': 800, 'main': 'Clear', 'description': 'onbewolkt', 'icon': '01n'}], 'base': 'stations', 'main': {'temp': 9.73, 'feels_like': 7.37, 'temp_min': 8.89, 'temp_max': 10.56, 'pressure': 1010, 'humidity': 69}, 'wind': {'speed': 1.57, 'deg': 45}, 'clouds': {'all': 0}, 'dt': 1587934311, 'sys': {'type': 3, 'id': 19993, 'country': 'BE', 'sunrise': 1587875306, 'sunset': 1587927549}, 'timezone': 7200, 'id': 2783151, 'name': 'Zulte', 'cod': 200}
\r\n{'stad': <Stad: Zulte>, 'temperatuur': 9.73, 'beschrijving': 'onbewolkt', 'icoon': '01n', 'tijdzone': 'UTC+2u', 'land': 'BE'}

\r\n 

\r\n\r\n

wat doorgegeven wordt naar template in json formaat wordt :

\r\n\r\n

{
\r\n  "stad": "Sydney",
\r\n  "temperatuur": 15.16,
\r\n  "beschrijving": "half bewolkt",
\r\n  "icoon": "03d",
\r\n  "tijdzone": "UTC+10u",
\r\n  "land": "AU"
\r\n}
\r\n{
\r\n  "stad": "Tokyo",
\r\n  "temperatuur": 13.66,
\r\n  "beschrijving": "zwaar bewolkt",
\r\n  "icoon": "04d",
\r\n  "tijdzone": "UTC+9u",
\r\n  "land": "JP"
\r\n}
\r\n{
\r\n  "stad": "Wellington",
\r\n  "temperatuur": 15.2,
\r\n  "beschrijving": "geheel bewolkt",
\r\n  "icoon": "04d",
\r\n  "tijdzone": "UTC+12u",
\r\n  "land": "NZ"
\r\n}
\r\n{
\r\n  "stad": "Zulte",
\r\n  "temperatuur": 8.17,
\r\n  "beschrijving": "onbewolkt",
\r\n  "icoon": "01n",
\r\n  "tijdzone": "UTC+2u",
\r\n  "land": "BE"
\r\n}

\r\n\r\n

Een nieuwe stad kan toegevoegd worden in de database en een willekeurige stad in de database kan weggedaan worden.

", "db_count": 172 }, { "taaknaam": "05. Django project enqueteproject", "taaktext": "

Enqueteproject

\r\n\r\n

schema

\r\n\r\n

\"\"

\r\n\r\n

\"\"

\r\n\r\n

Volgende vragen worden in de database gestopt :

\r\n\r\n

        1) Wat is je favoriete programmeerttaal ?

\r\n\r\n

                    6 keuzes :

\r\n\r\n\r\n\r\n

        2) Wat is je favoriete Ioerating Systeem ?

\r\n\r\n

                    5 keuzes :     

\r\n\r\n\r\n\r\n

        3) Wat is je favoriete Python Framework ?

\r\n\r\n

    3 keuzes :

\r\n\r\n\r\n\r\n

 

\r\n\r\n

 

\r\n\r\n

 

", "db_count": 158 }, { "taaknaam": "06. Django template language DTL", "taaktext": "

codering

\r\n\r\n

{%                                      %}

\r\n\r\n

extends "base.html

\r\n\r\n

csrf_token

\r\n\r\n

load static
\r\nload tz   indien USE_TZ = TRUE
\r\nload l10n   indien USE_L10N = TRUE
\r\nload i18n

\r\n\r\n

 

\r\n\r\n

block content
\r\nendblock | endblock content

\r\n\r\n

 

\r\n\r\n

block title
\r\nendblock title

\r\n\r\n

 

\r\n\r\n

block body
\r\nendblock body

\r\n\r\n

 

\r\n\r\n

for .... in .....

\r\n\r\n

empty

\r\n\r\n

    <li> set is empty </li>

\r\n\r\n

            endfor

\r\n\r\n

            for member in owner.member_set.all

\r\n\r\n

            value|default: "....."

\r\n\r\n

value|length
\r\nvalue|filesizeformat

\r\n\r\n

if var1

\r\n\r\n

{ { var1 } }

\r\n\r\n

elif var2

\r\n\r\n

{ { var2 } }

\r\n\r\n

else
\r\nendif

\r\n\r\n

firstof var1 var2 var3
\r\nforloop.counter
\r\nforloop.first
\r\nforloop.last

\r\n\r\n

if var == '....'
\r\nif var != '....'
\r\nif var < ...

\r\n\r\n

>
\r\n<=
\r\n>=

\r\n\r\n

if var is True
\r\nif var is None
\r\nif var is not True
\r\nif var is not None
\r\nif a<b and c<d
\r\nif a>b or c<d
\r\nif messages|length >= 100

\r\n\r\n

ifequal a b
\r\nendifequal

\r\n\r\n

ifnotequal a b
\r\nendifnotequal

\r\n\r\n

ifchanged
\r\nendifchanged

\r\n\r\n

comment
\r\nendcomment

\r\n\r\n

include ".....html'

\r\n\r\n

now "d-m-Y"

\r\n\r\n

url ' '

\r\n\r\n

 

\r\n\r\n

variabel

\r\n\r\n

{ {                                           } }

\r\n\r\n

object
\r\nobject.veld

\r\n\r\n

value | capfirst
\r\nvalue | center: "15"
\r\nvalue | cut: "b"
\r\nvalue | date: "d/m/Y/H"
\r\nvalue | date: "SHORT_DATE_FORMAT"
\r\nvalue | default: " "
\r\nvalue | dictsort: " "
\r\nvalue | divisibleby: " "
\r\nvalue | first
\r\nvalue | floatformat: "-3"
\r\nvalue | git_digit: "2"

\r\n\r\n

value | join: "// "

\r\n\r\n

value | last
\r\nvalue | length
\r\nvalue | lower
\r\nvalue | ....

\r\n\r\n

commentaar

\r\n\r\n

{# dit is commentaar #}

\r\n\r\n

 

\r\n\r\n

gebruik django-html package in atom

\r\n\r\n


\r\n 

", "db_count": 163 }, { "taaknaam": "07. Django Simple Database Access Optimizations", "taaktext": "

Accessing Foreign Key Values

\r\n\r\n

If you only need the ID of the Foreign Key:

\r\n\r\n

Do

\r\n\r\n
\r\npost.author_id
\r\n\r\n

Don't

\r\n\r\n
\r\npost.author.id
\r\n\r\n

If you have a foreign key named author, Django will automatically store the primary key in the property author_id, while in the author property will be stored a lazy database reference. So if you access the id via the author instance, like this post.author.id, it will cause an additional query.

\r\n\r\n
\r\n

Bulk Insert on Many to Many Fields

\r\n\r\n

Do

\r\n\r\n
\r\nuser.groups.add(administrators, managers)
\r\n\r\n

Don't

\r\n\r\n
\r\nuser.groups.add(administrators)\r\nuser.groups.add(managers)
\r\n\r\n
\r\n

Counting QuerySets

\r\n\r\n

If you only need the count:

\r\n\r\n

Do

\r\n\r\n
\r\nusers = User.objects.all()\r\nusers.count()\r\n\r\n# Or in template...\r\n{{ users.count }}
\r\n\r\n

Don't

\r\n\r\n
\r\nusers = User.objects.all()\r\nlen(users)\r\n\r\n# Or in template...\r\n{{ users|length }}
\r\n\r\n
\r\n

Empty QuerySets

\r\n\r\n

If you only need to know if the queryset is empty:

\r\n\r\n

Do

\r\n\r\n
\r\ngroups = Group.objects.all()\r\nif groups.exists():\r\n    # Do something...
\r\n\r\n

Don't

\r\n\r\n
\r\ngroups = Group.objects.all()\r\nif groups:\r\n    # Do something...
\r\n\r\n
\r\n

Reduce Query Counts

\r\n\r\n

Do

\r\n\r\n
\r\nreview = Review.objects.select_related('author').first()  # Select the Review and the Author in a single query\r\nname = review.author.first_name
\r\n\r\n

Don't

\r\n\r\n
\r\nreview = Review.objects.first()  # Select the Review\r\nname = review.author.first_name  # Additional query to select the Author
\r\n\r\n
\r\n

Select Only What You Need

\r\n\r\n

Let’s say the Invoice model has 50 fields and you want to create a view to display just a summary, with the numberdate and value:

\r\n\r\n

Do

\r\n\r\n
\r\n# views.py\r\n# If you don't need the model instance, go for:\r\ninvoices = Invoice.objects.values('number', 'date', 'value')  # Returns a dict\r\n\r\n# If you still need to access some instance methods, go for:\r\ninvoices = Invoice.objects.only('number', 'date', 'value')  # Returns a queryset\r\n\r\n# invoices.html\r\n<table>\r\n  {% for invoice in invoices %}\r\n    <tr>\r\n      <td>{{ invoice.number }}</td>\r\n      <td>{{ invoice.date }}</td>\r\n      <td>{{ invoice.value }}</td>\r\n    </tr>\r\n  {% endfor %}\r\n</table>
\r\n\r\n

Don't

\r\n\r\n
\r\n# views.py\r\ninvoices = Invoice.objects.all()\r\n\r\n# invoices.html\r\n<table>\r\n  {% for invoice in invoices %}\r\n    <tr>\r\n      <td>{{ invoice.number }}</td>\r\n      <td>{{ invoice.date }}</td>\r\n      <td>{{ invoice.value }}</td>\r\n    </tr>\r\n  {% endfor %}\r\n</table>
\r\n\r\n
\r\n

Bulk Updates

\r\n\r\n

Do

\r\n\r\n
\r\nfrom django.db.models import F\r\n\r\nProduct.objects.update(price=F('price') * 1.2)
\r\n\r\n

Don't

\r\n\r\n
\r\nproducts = Product.objects.all()\r\nfor product in products:\r\n    product.price *= 1.2\r\n    product.save()
", "db_count": 158 }, { "taaknaam": "08. Django Sitemap", "taaktext": "

Django Sitemap

\r\n\r\n

Binnen django is er een ingebouwde sitemap framework :

\r\n\r\n

Een XML bestand : sitemap.xml is ter beschikking dat de zoekmachine bepaalt hoe dikwijls een website pagina is aangepast of gecreeerd ....

\r\n\r\n

 

\r\n\r\n\r\n\r\n

De sitemap framework vereist een update van onze database :

\r\n\r\n\r\n\r\n

XML bestand

\r\n\r\n\r\n\r\n

Het XML bestand maak gebruik van ' example.com ' voor de naam van onze website. Diit komt van de  'sites framework'.

\r\n\r\n

Dit kan aangepast worden als  je in  Django admin mode gaat dan kun je   Sites  aanpassen in de sectie WebSites . .

", "db_count": 168 }, { "taaknaam": "09. Django Opzet gevoelige sleutels in environment variabelen", "taaktext": "

Django Opzet environment variabelen

\r\n\r\n

Dotenv

\r\n\r\n

Dotenv is een manier om geheime sleutels (publieke als secret) en wachtwoorden op te slaan in environment variabelen.

\r\n\r\n

Deze worden opgeslagen in een .env bestand. het bestand .gitignore moet het bestand .env bevatten zodat dit bestand niet opgeladen wordt in github dit om te voorkomen dat deze sleutels openbaar worden !

\r\n\r\n

Om gebruik te kunnen maken van dotenv moet het python pakket python-dotenv geinstalleerd worden.

\r\n\r\n
\r\n

pip install python-dotenv

\r\n
\r\n\r\n

.env bestand

\r\n\r\n
\r\n

export DJANGO_SETTINGS_MODULE=django_project_naam.settings.prod
\r\nexport SECRET_KEY='
mijn_secret_key'
\r\nexport EMAIL_HOST_PASSWORD='geheim_wachtwoord '
\r\nexport STRIPE_LIVE_PUBLIC_KEY='live_publieke_sleutel'
\r\nexport STRIPE_LIVE_SECRET_KEY='live_geheime_sleutel '
\r\nexport STRIPE_PUBLIC_KEY='test_publieke_sleutel '

\r\n\r\n

'
\r\nexport STRIPE_SECRET_KEY='test_geheime_sleutel '

\r\n
\r\n\r\n

django_project_naam = naam van je django project gemaakt met de django-admin tool

\r\n\r\n

settings.prod ofwel settings

\r\n\r\n

mijn_secret_key = kan opnieuw gegenereerd  worden op website : https://miniwebtool.com/django-secret-key-generator/

\r\n\r\n

wsgi.py

\r\n\r\n
\r\n

import os
\r\nfrom dotenv import load_dotenv

\r\n\r\n

project_folder = os.path.expanduser('~/mijn_project_naam')

\r\n\r\n

load_dotenv(os.path.join(project_folder, '.env'))
\r\nfrom django.core.wsgi import get_wsgi_application
\r\napplication = get_wsgi_application()

\r\n
\r\n\r\n

mijn_project_naam = naam van je django naam folder-map

\r\n\r\n

postactivate   in  ~/local/share/virtualenvs/env_django_project_naam/bin/

\r\n\r\n
\r\n

#!/bin/bash
\r\n# This hook is sourced after this virtualenv is activated.

\r\n\r\n

set -a; source ~/mijn_project_naam/.env;
\r\n 

\r\n
\r\n\r\n

settings/base.py

\r\n\r\n
\r\n

SECRET_KEY = os.environ['SECRET_KEY']

\r\n\r\n

...

\r\n\r\n

INSTALLED_APPS = [

\r\n\r\n

    'accounts.apps.AccountsConfig',  
\r\n    'django.contrib.admin',
\r\n    'django.contrib.auth',
\r\n    'django.contrib.contenttypes',
\r\n    'django.contrib.sessions',
\r\n    'django.contrib.messages',
\r\n    'django.contrib.staticfiles',
\r\n    'django.contrib.sites',
\r\n    'django.contrib.sitemaps',
\r\n    'django.contrib.humanize',
\r\n    'django_extensions',
\r\n    'land',
\r\n    'ckeditor',
\r\n    'ckeditor_uploader',
\r\n    'robots'
\r\n    'base',

\r\n\r\n

   ]

\r\n\r\n

...

\r\n\r\n

LANGUAGE_CODE = 'nl'

\r\n\r\n

TIME_ZONE = 'Europe/Brussels'

\r\n\r\n

...

\r\n\r\n

STATIC_URL = '/static/'

\r\n\r\n

MEDIA_URL = '/media/'
\r\nMEDIA_ROOT = os.path.join(BASE_DIR, 'media/')

\r\n\r\n

CKEDITOR_CONFIGS = {
\r\n    'default': {
\r\n        # Editor Width Adaptation
\r\n        'width':'auto',
\r\n        'height':'250px',
\r\n        # tab key conversion space number
\r\n        'tabSpaces': 4,
\r\n        # Toolbar Style
\r\n        'toolbar': 'full',
\r\n        # 'Custom',
\r\n        # Toolbar buttons
\r\n        # 'toolbar_Custom': [
\r\n        #     # Emotional Code Block
\r\n        #     ['Smiley', 'CodeSnippet'],
\r\n        #     # Font Style
\r\n        #     ['Bold', 'Italic', 'Underline', 'RemoveFormat', 'Blockquote'],
\r\n        #     # Font color
\r\n        #     ['TextColor', 'BGColor'],
\r\n        #     # Link link
\r\n        #     ['Link', 'Unlink'],
\r\n        #     # List of items
\r\n        #     ['NumberedList', 'BulletedList'],
\r\n        #     # Maximization
\r\n        #     ['Maximize']
\r\n        # ],
\r\n        # Add Prism related plug-ins
\r\n        'extraPlugins': ','.join(['codesnippet', 'widget', 'lineutils']),
\r\n    }
\r\n}

\r\n\r\n

CKEDITOR_UPLOAD_PATH = 'upload/'
\r\nCKEDITOR_IMAGE_BACKEND = 'pillow'

\r\n\r\n

LOGIN_URL = '/accounts/login/'
\r\nLOGIN_REDIRECT_URL = "/"
\r\nLOGOUT_REDIRECT_URL = "/"

\r\n\r\n


\r\nEMAIL_USE_TLS= True
\r\nEMAIL_HOST= 'smtp.gmail.com'
\r\nEMAIL_PORT= 587
\r\nDEFAULT_FROM_EMAIL = 'ulefr01.pythonanywhere.com'
\r\nEMAIL_HOST_USER= 'ulefr01@gmail.com'
\r\nEMAIL_HOST_PASSWORD=
os.environ['EMAIL_HOST_PASSWORD']
\r\nEMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'

\r\n\r\n

LOG_DIR = os.path.join(BASE_DIR, 'log')

\r\n\r\n

LOGGING = {
\r\n    'version': 1,
\r\n    'disable_existing_loggers': False,
\r\n    # Debugger is active
\r\n    'handlers': {
\r\n        'django_all': {
\r\n            'class': 'logging.FileHandler',
\r\n            'filename': os.path.join(LOG_DIR, 'django.log'),
\r\n        },
\r\n        'land_all': {
\r\n            'class': 'logging.FileHandler',
\r\n            'filename': os.path.join(LOG_DIR, 'land.log'),
\r\n        },
\r\n    },
\r\n    'loggers': {
\r\n        'django.server': {
\r\n            'handlers': ['django_all'],
\r\n            'level': 'DEBUG',
\r\n        },
\r\n        'django.request': {
\r\n            'handlers': ['django_all'],
\r\n            'level': 'INFO',
\r\n        },
\r\n        # 'django.db.backends': {
\r\n        #     'handlers': ['django_all'],
\r\n        #     'level': 'DEBUG',
\r\n        # },
\r\n        'adres': {
\r\n            'handlers': ['land_all'],
\r\n            'level': 'INFO',
\r\n        },
\r\n    },
\r\n}

\r\n
\r\n\r\n

settings/dev.py

\r\n\r\n
\r\n

from .base import *

\r\n\r\n

DEBUG = True

\r\n\r\n

ALLOWED_HOSTS = [
\r\n    '127.0.0.2',
\r\n    
\r\n]

\r\n\r\n

# met gunicorn en gebruik van  .env
\r\nSTATIC_ROOT = 'django_project_naam /static'

\r\n\r\n

STATICFILES_DIRS = [
\r\n     os.path.join(BASE_DIR, 'static/'),

\r\n\r\n

]

\r\n\r\n

# met gunicorn volgende twee lijnen niet commentareren 

\r\n\r\n

STRIPE_PUBLIC_KEY = os.environ['STRIPE_PUBLIC_KEY]'
\r\nSTRIPE_SECRET_KEY  = os.environ['STRIPE_SECRET_KEY]'

\r\n\r\n

# ofwel met ./manage-py runserver_plus    zonder  .env  volgende twee lijnen 

\r\n\r\n

# STRIPE_PUBLIC_KEY = 'pk_test_....'
\r\n# STRIPE_SECRET_KEY = 'sk_test_....'

\r\n 

\r\n
\r\n\r\n

settings/prod.py

\r\n\r\n
\r\n

from .base import *

\r\n\r\n

DEBUG = False

\r\n\r\n

ALLOWED_HOSTS = [
\r\n    'ulefr03.eu.pythonanywhere.com'
\r\n    ]

\r\n\r\n

# ./manage.py collectstatic (production only)
\r\nSTATIC_ROOT = '
django_project_naam/static'

\r\n\r\n

STRIPE_LIVE_PUBLIC_KEY = os.environ['STRIPE_LIVE_PUBLIC_KEY]'
\r\nSTRIPE_LIVE_SECRET_KEY = os.environ['STRIPE_LIVE_SECRET_KEY]'

\r\n\r\n

# secure in production
\r\nSESSION_COOKIE_SECURE = True
\r\nCSRF_COOKIE_SECURE = True
\r\nSECURE_HSTS_SECONDS = 31536000
\r\nSECURE_HSTS_INCLUDE_SUBDOMAINS = True
\r\nSECURE_HSTS_PRELOAD = True
\r\nSECURE_SSL_REDIRECT = True
\r\nSECURE_REFERRER_POLICY = 'strict-origin'
\r\nSECURE_BROWSER_XSS_FILTER = True

\r\n
\r\n\r\n

test_opzet_environment_variabelen

\r\n\r\n
\r\n

dev.py aanpassen

\r\n\r\n

start een virtuele omgeving

\r\n\r\n

vf  activate  env_django_project_naam 

\r\n\r\n

enkel in test  (fish) :   source  .env

\r\n\r\n

gunicorn  -b  127.0.0.2:8000  -w 5  django_project_naam .wsgi

\r\n            of\r\n\r\n

gunicorn  --bind = 127.0.0.2:8000  --workers = 5  django_project_naam .wsgi

\r\n
\r\n\r\n

probleem /favicon.ico not found

\r\n\r\n
\r\n

chrome probleem : Fix for Google Chrome favicon loading in Django. You may have noticed that Chrome has issues loading the appropriate favicon on Django if you have it in a different path other than just '/favicon.ico'.

\r\n\r\n

toevoegen in urls.py : 

\r\n\r\n

        from django.views.generic.base import RedirectView

\r\n\r\n

    path('favicon.ico/', RedirectView.as_view(url='/static/css/favicon.ico')),

\r\n
\r\n\r\n
", "db_count": 204 }, { "taaknaam": "10. HTTP status codes", "taaktext": "

zie : https://nl.wikipedia.org/wiki/Lijst_van_HTTP-statuscodes

\r\n\r\n

belangrijkste codes

\r\n\r\n", "db_count": 177 }, { "taaknaam": "11. Python", "taaktext": "

Wat ?

\r\n\r\n\r\n\r\n

eigen pakketbeheerder

\r\n\r\n

python heeft een eigen pakketbeheerder = PIP 
\r\nPIP is een Python-pakketbeheerder die wordt gebruikt om Python-pakketten van Python-pakketindex te installeren      

\r\n\r\n

python website

\r\n\r\n

https://www.python.org/
\r\nwat betreft : python about
\r\ndoc : python doc
\r\nleren : python leren
\r\nverschil met andere programeertalen : 
\r\n    inspringen (indentation)
\r\n    geen begin/end
\r\n    geen {/}
\r\n    geen then/endif

\r\n    python interpreter
\r\n    niet voldaan dan krijg je een IndentationError : unexpected indent

\r\n\r\n

verzamelingen

\r\n\r\n

    [ ..., ..., ... ]  : list

\r\n\r\n

    { ..., ..., ... } :  dictionary

\r\n\r\n

    ( ..., ..., ... ) : tuple

\r\n\r\n

if/else

\r\n\r\n

    if [ .... <= .... ] :

\r\n\r\n

        .....

\r\n\r\n

        .....

\r\n\r\n

    else:

\r\n\r\n

        ....

\r\n\r\n

        ....

\r\n\r\n

formateren

\r\n\r\n

    format  %  values

\r\n\r\n

        %s voor strings, %i integer, %f floating point, %X hexadecimaal,  %c character,  

\r\n\r\n

    " mijn naam is = (voornaam.= %s , familienaam = %s" % ("franz", "ulenaers") 

\r\n\r\n

 

", "db_count": 190 }, { "taaknaam": "12. CKEDITOR in Django", "taaktext": "

ckeditor

\r\n\r\n

CKEditor is een online WYSIWYG (what you see is what you get) editor dat je kunt gebruiken in een webbrowser (Chrome, Firefox, Safari, Internet Explorer, ...)

\r\n\r\n\r\n\r\n

Hier de menu :

\r\n\r\n

\"\"

\r\n\r\n

voor meer zie : https://www.quackit.com/html/html_editors/

\r\n\r\n

en   https://www.quackit.com/html/online-html-editor/full/

", "db_count": 191 }, { "taaknaam": "Apt package tool", "taaktext": "
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n

apt.md

\r\n
\r\n
\r\n\r\n
\r\n
\r\n

titel: "apt"

\r\n\r\n

beschrijving: "Advanced Package Tool." "Het installeren van deb-pakketten op een Debian, Ubuntu .... Linux systeem"

\r\n\r\n

categoriën:

\r\n\r\n
    \r\n\t
  • install
  • \r\n\t
  • apt
  • \r\n\t
  • upgrade
  • \r\n\t
  • remove
  • \r\n\t
  • purge
  • \r\n
\r\n\r\n
\r\n

apt package tool

\r\n\r\n

update apt database

\r\n\r\n
\r\n
\r\n        sudo apt update
\r\n
\r\n\r\n

upgrade pakketten

\r\n\r\n
\r\n
\r\n        sudo apt upgrade
\r\n
\r\n\r\n

installeer een pakket

\r\n\r\n

installeer een pakket je-pakket-naam

\r\n\r\n
\r\n
\r\n        sudo apt install <je-pakket-naam>
\r\n
\r\n\r\n

pakket wegdoen

\r\n\r\n

doe een pakket je-pakket-naam weg

\r\n\r\n
\r\n
\r\n        sudo apt remove <je-pakket-naam>
\r\n
\r\n\r\n

pakket volledig wegdoen

\r\n\r\n

doe een pakket je-pakket-naam volledig weg (alsook configuratie bestanden)

\r\n\r\n
\r\n
\r\n       sudo apt purge <je-pakket-naam>
\r\n
\r\n\r\n

zoek een pakket

\r\n\r\n
\r\n
\r\n       # aptitude search <je-pakket-naam>        \r\n       apt search <je-pakket-naam>
\r\n
\r\n\r\n

toon een pakket

\r\n\r\n
\r\n
\r\n       apt show <je-pakket-naam>\r\n       # meer info met `apt-cache show`\r\n       # apt-cache show <je-pakket-naam> 
\r\n
\r\n\r\n

opkuis

\r\n\r\n

opkuis deb bestanden

\r\n\r\n

apt-get clean doet al de deb bestanden weg uit de map /var/cache/apt/archives/

\r\n\r\n
\r\n
\r\n        sudo apt-get clean\r\n        # of\r\n        sudo apt clean
\r\n
\r\n\r\n

apt autoclean / apt autoremove kuist niet al de bestanden op uit je /var/cache/apt/archives !

\r\n\r\n

residual config files

\r\n\r\n
\r\n
\r\n        # uitvoeren  \r\n        dpkg -l | grep '^rc'\r\n        # enkel de naam van de pakketten\r\n        # dpkg -l | grep "^rc" | awk '{print $2}'
\r\n
\r\n\r\n

purge all residual config pakketten

\r\n\r\n
\r\n    sudo apt purge $(dpkg -l | grep \"^rc\" | awk '{print $2}')\r\n
\r\n\r\n

geinstalleerde pakketten

\r\n\r\n
\r\n
\r\n        # \r\n        dpkg -l | grep '^hi\\|^ii\\|^i'\r\n        # enkel de naam van de pakketten\r\n        # dpkg -l | grep '^hi\\|^ii\\|^i' | awk '{print $2}'
\r\n
\r\n\r\n

apt-cache policy $(dpkg -l | grep "^hi|^ii|^i" | awk '{print $2}')

\r\n\r\n

apt-cache policy $(dpkg -l | grep "^hi|^ii|^i" | awk '{print $2}') >~/outputs/aptlog_pakketten_20220721.out

\r\n\r\n

sources.list

\r\n\r\n
\r\n
\r\n        # sid = unstable is testing  debian 12  goto https://packages.debian.org/sid/amd64\r\n        # trixie =           debian 13 in 2025\r\n        # bookworm = testing debian 12 16/08/2021\r\n        # bullseye = stable debian 11  03/2021\r\n        # buster = oldstable debian 10\r\n        # stretch = oldstable debian 9\r\n        # jessie = oldstable debian 8\r\n        # deb cdrom:[Official Debian GNU/Linux Live 11.0.0 gnome 2021-08-14T11:22]/ bullseye main\r\n        # deb cdrom:[Official Debian GNU/Linux Live 11.0.0 gnome 2021-08-14T11:22]/ bullseye main\r\n        deb http://ftp.be.debian.org/debian/ experimental main contrib non-free\r\n        deb http://ftp.be.debian.org/debian/ testing main contrib non-free\r\n        deb http://ftp.be.debian.org/debian/ bullseye main contrib non-free\r\n        deb http://ftp.be.debian.org/debian/ buster main contrib non-free\r\n        # deb-src http://ftp.be.debian.org/debian/ bullseye main\r\n        deb http://security.debian.org/debian-security testing-security main contrib non-free\r\n        deb http://security.debian.org/debian-security bullseye-security main contrib non-free\r\n        # deb-src http://security.debian.org/debian-security bullseye-security main\r\n        # bullseye-updates, to get updates before a point release is made;\r\n        # see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports\r\n        deb http://ftp.be.debian.org/debian/ testing-updates main contrib non-free\r\n        deb http://ftp.be.debian.org/debian/ bullseye-updates main contrib non-free\r\n        # deb-src http://ftp.be.debian.org/debian/ bullseye-updates main\r\n        deb http://ftp.be.debian.org/debian testing-backports main contrib non-free\r\n        deb http://ftp.be.debian.org/debian bullseye-backports main contrib non-free
\r\n
\r\n\r\n

preferences

\r\n\r\n
\r\n
\r\n        # \r\n        Package: *\r\n        Pin: release a=bullseye-backports\r\n        Pin-Priority: 100\r\n        Package: *\r\n        Pin: release a=bullseye\r\n        Pin-Priority: 500\r\n        Package: *\r\n        Pin: release a=testing\r\n        Pin-Priority: -1
\r\n
\r\n\r\n
\r\n

noot: je kunt wel nog pakketten type testing installeren met apt install -t testing je_pakket !

\r\n
\r\n\r\n

upgrade bullseye-backports

\r\n\r\n
\r\n
\r\n        sudo apt -t bullseye-backports upgrade
\r\n
\r\n\r\n

local/obsolete packages

\r\n\r\n
\r\n
\r\n        aptitude search '?obsolete'
\r\n
\r\n\r\n

output is

\r\n\r\n
\r\n
\r\n        i   boostnote.next                             - .                                                    \r\n        i   element-desktop                            - A feature-rich client for Matrix.org                 \r\n        i   gir1.2-appindicator3-0.1                   - Typelib files for libappindicator3-1                 \r\n        i   hibernate                                  - smartly puts your computer to sleep (suspend to RAM o\r\n        i A libappindicator3-1                         - allow applications to export a menu into the panel --\r\n        i A libffi6                                    - Foreign Function Interface library runtime           \r\n        i A libindicator3-7                            - panel indicator applet - shared library              \r\n        i A libvala-0.52-0                             - C# like language for the GObject system - library    \r\n        i A libvala-0.52-dev                           - C# like language for the GObject system - development\r\n        i A python-cairo                               - Python bindings for the Cairo vector graphics library\r\n        i A python-feedparser                          - Universal Feed Parser for Python                     \r\n        i A python-gobject-2                           - deprecated static Python bindings for the GObject lib\r\n        i   python-gtk2                                - Python bindings for the GTK+ widget set              \r\n        i A python-libxml2                             - Python bindings for the GNOME XML library            \r\n        i A python-numpy                               - Numerical Python adds a fast array facility to the Py\r\n        i A python-tidylib                             - Python 2 wrapper for HTML Tidy (tidylib)             \r\n        i A python-utidylib                            - Python wrapper for TidyLib                           \r\n        i   rawdog                                     - RSS Aggregator Without Delusions Of Grandeur         \r\n        i A uswsusp                                    - tools to use userspace software suspend provided by L
\r\n
\r\n\r\n

gnome software

\r\n\r\n
\r\n
\r\n       apt-cache policy 'gnome*' 
\r\n
\r\n\r\n

check for gnome test versions

\r\n\r\n
\r\n
\r\n        apt-cache policy $(dpkg -l | grep '^ii\\^hi\\^i' | awk '{print $2}'| grep 'gnome')
\r\n
\r\n\r\n

apt list | grep lokaal

\r\n\r\n

dit al je geen buster hebt in je sources.list maar toch buster pakketten geinstalleerd zijn !!!

\r\n\r\n
\r\n
\r\n       apt list | grep lokaal
\r\n
\r\n\r\n
\r\n

output

\r\n
\r\n\r\n
\r\n
\r\n        gir1.2-appindicator3-0.1/now 0.4.92-7 amd64 [geïnstalleerd,lokaal]\r\n        hibernate/now 2.0+15+g88d54a8-1 all [geïnstalleerd,lokaal]\r\n        libappindicator3-1/now 0.4.92-7 amd64 [geïnstalleerd,lokaal]\r\n        libffi6/now 3.2.1-9 amd64 [geïnstalleerd,lokaal]\r\n        libindicator3-7/now 0.5.0-4 amd64 [geïnstalleerd,lokaal]\r\n        libvala-0.52-0/now 0.52.5-1 amd64 [geïnstalleerd,lokaal]\r\n        libvala-0.52-dev/now 0.52.5-1 amd64 [geïnstalleerd,lokaal]\r\n        python-cairo/now 1.16.2-1+b1 amd64 [geïnstalleerd,lokaal]\r\n        python-feedparser/now 5.2.1-1 all [geïnstalleerd,lokaal]\r\n        python-gobject-2/now 2.28.6-13+b1 amd64 [geïnstalleerd,lokaal]\r\n        python-gtk2/now 2.24.0-5.1+b1 amd64 [geïnstalleerd,lokaal]\r\n        python-libxml2/now 2.9.4+dfsg1-7+deb10u2 amd64 [geïnstalleerd,lokaal]\r\n        python-numpy/now 1:1.16.2-1 amd64 [geïnstalleerd,lokaal]\r\n        python-tidylib/now 0.3.2~dfsg-4 all [geïnstalleerd,lokaal]\r\n        python-utidylib/now 0.5-2 all [geïnstalleerd,lokaal]\r\n        rawdog/now 2.23-2 all [geïnstalleerd,lokaal]\r\n        uswsusp/now 1.0+20120915-6.2 amd64 [geïnstalleerd,lokaal]\r\n    
\r\n
\r\n\r\n

unattended-upgrades

\r\n\r\n

installeren

\r\n\r\n
\r\n
\r\n        sudo apt install unattended-upgrades apt-listchanges\r\n        sudo apt install apt-config-auto-update\r\n        sudo apt install powermgmt-base
\r\n
\r\n\r\n

welke settings automatisch laten upgrade

\r\n\r\n
\r\n
\r\n        sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
\r\n
\r\n\r\n
\r\n    zet in het bestand 50unattended-upgrades :\r\n
\r\n\r\n
\r\n
\r\n        "origin=Debian,codename=${distro_codename}-updates";\r\n//      "origin=Debian,codename=${distro_codename}-proposed-updates";\r\n        "origin=Debian,codename=${distro_codename},label=Debian";\r\n        "origin=Debian,codename=${distro_codename},label=Debian-Security";\r\n        "origin=Debian,codename=${distro_codename}-security,label=Debian-Security";\r\n\r\n        Unattended-Upgrade::Mail "root";\r\n\r\n        Unattended-Upgrade::Automatic-Reboot "true";\r\n\r\n        Unattended-Upgrade::Automatic-Reboot-WithUsers "true";\r\n
\r\n
\r\n\r\n
\r\n
\r\n        sudo nano /etc/apt/apt.conf.d/51unattended-upgrades-local
\r\n
\r\n\r\n
\r\n    zet in het bestand 51unattended-upgrades-local :\r\n
\r\n\r\n
\r\n
\r\n        Unattended-Upgrade::Origins-Pattern {\r\n\t"origin=*";\t\r\n        };
\r\n
\r\n\r\n

hoe test ik het , hoe werkt het ?

\r\n\r\n
\r\n
\r\n        # steek stekker in stopcontact zodat je niet op batterij werkt\r\n        sudo unattended-upgrades        
\r\n
\r\n\r\n

Toegang krijgen tot logs met onbeheerde upgrades

\r\n\r\n
\r\n
\r\n        sudo -i\r\n        cd /var/log/unattended-upgrades/\r\n        ls 
\r\n
\r\n\r\n

hoe automatisch starten unattended-upgrades op een bepaald ogenblik ?

\r\n\r\n
    \r\n\t
  • \r\n\t

    cronjob maken met crontab

    \r\n\r\n\t
    \r\n  bijvoorbeeld elke dag om 22:00\r\n
    \r\n\t
  • \r\n
\r\n\r\n
\r\n
\r\n        nano /etc/crontab
\r\n
\r\n\r\n
\r\n    voeg volgende lijn toe in bestand /etc/contab\r\n
\r\n\r\n
\r\n
\r\n        00 22 * * * /usr/bin/unattended-upgrade -v
\r\n
\r\n\r\n
    \r\n\t
  • check cronjob log
  • \r\n
\r\n\r\n
\r\n
\r\n        nano /etc/rsyslog.d/50-default.conf
\r\n
\r\n\r\n
\r\n    voeg volgende lijn toe\r\n
\r\n\r\n
\r\n
\r\n        #\r\n        cron.*          /var/log/cron.log\r\n        #
\r\n
\r\n\r\n
\r\n    check cronjob log in /var/log/cron.log\r\n
\r\n\r\n
    \r\n\t
  • bij problemen
  • \r\n
\r\n\r\n
\r\n
\r\n        apt list --upgradable\r\n        systemctl status cron\r\n        cat /etc/crontab\r\n        systemctl status rsyslog\r\n        systemctl status unattended-upgrade\r\n        cat /var/log/cron.log
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
", "db_count": 114 }, { "taaknaam": "Backup disk device settings van mijn Dell Inspiron op /backup2", "taaktext": "
\r\n#!/bin/bash\r\n# backup op backup2\r\nLD=\"/backup2/\"\r\nDATUM=\"$(date +%Y%m%d)\"\r\nLF=backupdisk_$(date +%Y%m%d).out\r\nRES=1\r\n# only run as root\r\nif [ \"$(id -u)\" != '0' ]\r\nthen\r\n        echo \"Deze bash script moet opgestart worden met root rechten\"\r\n        exit $RES\r\nfi\r\necho \"====== start backupdisk_sets ======\"\r\necho \"====== start backupdisk_sets ======\" >>$LD$LF\r\necho \"-----------------------------------\" >>$LD$LF\r\necho \" inxi \"\r\necho \" inxi \" >>$LD$LF\r\necho \"------\" >>$LD$LF\r\n/usr/bin/inxi -FGISZMxxxpu\r\n/usr/bin/inxi -FGISZMxxxpu >>$LD$LF\r\necho \" lsblk \"\r\necho \" lsblk \" >>$LD$LF\r\necho \"-------\" >>$LD$LF\r\nlsblk\r\nlsblk >>$LD$LF\r\necho \" gdisk /dev/sda \"\r\necho \" gdisk /dev/sda \" >>$LD$LF\r\necho \"----------------\" >>$LD$LF\r\ngdisk -l /dev/sda\r\ngdisk -l /dev/sda >>$LD$LF\r\necho \" parted /dev/sda \"\r\necho \" parted /dev/sda \" >>$LD$LF\r\nparted /dev/sda print\r\nparted /dev/sda print >>$LD$LF\r\necho \" gdisk /dev/sdb \"\r\necho \" gdisk /dev/sdb \" >>$LD$LF\r\necho \"----------------\" >>$LD$LF\r\ngdisk -l /dev/sdb\r\ngdisk -l /dev/sdb >>$LD$LF\r\necho \" parted /dev/sdb \"\r\necho \" parted /dev/sdb \" >>$LD$LF\r\necho \"----------------\" >>$LD$LF\r\nparted /dev/sdb print\r\nparted /dev/sdb print >>$LD$LF\r\necho \" blkid \"\r\necho \" blkid \" >>$LD$LF\r\necho \"-------\" >>$LD$LF\r\nblkid\r\nblkid >>$LD$LF\r\necho \" pvs \"\r\necho \" pvs \" >>$LD$LF\r\necho \"-----\" >>$LD$LF\r\npvs\r\npvs >>$LD$LF\r\necho \" vgs \"\r\necho \" vgs \" >>$LD$LF\r\necho \"-----\" >>$LD$LF\r\nvgs\r\nvgs >>$LD$LF\r\necho \" lvs \"\r\necho \" lvs \" >>$LD$LF\r\necho \"-----\" >>$LD$LF\r\nlvs\r\nlvs >>$LD$LF\r\nlvs -a -o +devices\r\nlvs -a -o +devices >>$LD$LF\r\necho \"eerste 2047 sectoren \"\r\necho \"eerste 2047 sectoren \" >>$LD$LF\r\necho \"---------------------\" >>$LD$LF\r\necho \"dd if=/dev/sda of=sda2047.mbr bs=512 count=2047\"\r\necho \"dd if=/dev/sda of=sda2047.mbr bs=512 count=2047\" >>$LD$LF\r\ndd if=/dev/sda of=/backup2/sda2047_${DATUM}.mbr bs=512 count=2047\r\necho \"dd if=/dev/sdb of=sdb2047.mbr bs=512 count=2047\"\r\necho \"dd if=/dev/sdb of=sdb2047.mbr bs=512 count=2047\" >>$LD$LF\r\ndd if=/dev/sdb of=/backup2/sdb2047_${DATUM}.mbr bs=512 count=2047\r\n\r\nsync\r\nRES=0\r\nexit $RES\r\n
\r\n\r\n

 

", "db_count": 157 }, { "taaknaam": "Backup disk device settings van mijn Dell Inspiron op externe schijf /myssd2_data", "taaktext": "
\r\n#!/bin/bash\r\n# backup op myssd2_data\r\nLD=\"/myssd2_data/\"\r\nDATUM=\"$(date +%Y%m%d)\"\r\nLF=backupdisk_$(date +%Y%m%d).out\r\nRES=1\r\n# only run as root\r\nif [ \"$(id -u)\" != '0' ]\r\nthen\r\n        echo \"Deze bash script moet opgestart worden met root rechten\"\r\n        exit $RES\r\nfi\r\necho \"====== start backupdisk_sets ======\"\r\necho \"====== start backupdisk_sets ======\" >>$LD$LF\r\necho \"-----------------------------------\" >>$LD$LF\r\necho \" inxi \"\r\necho \" inxi \" >>$LD$LF\r\necho \"------\" >>$LD$LF\r\n/usr/bin/inxi -FGISZMxxxpu\r\n/usr/bin/inxi -FGISZMxxxpu >>$LD$LF\r\necho \" lsblk \"\r\necho \" lsblk \" >>$LD$LF\r\necho \"-------\" >>$LD$LF\r\nlsblk\r\nlsblk >>$LD$LF\r\necho \" gdisk /dev/sda \"\r\necho \" gdisk /dev/sda \" >>$LD$LF\r\necho \"----------------\" >>$LD$LF\r\ngdisk -l /dev/sda\r\ngdisk -l /dev/sda >>$LD$LF\r\necho \" parted /dev/sda \"\r\necho \" parted /dev/sda \" >>$LD$LF\r\nparted /dev/sda print\r\nparted /dev/sda print >>$LD$LF\r\necho \" gdisk /dev/sdb \"\r\necho \" gdisk /dev/sdb \" >>$LD$LF\r\necho \"----------------\" >>$LD$LF\r\ngdisk -l /dev/sdb\r\ngdisk -l /dev/sdb >>$LD$LF\r\necho \" parted /dev/sdb \"\r\necho \" parted /dev/sdb \" >>$LD$LF\r\necho \"----------------\" >>$LD$LF\r\nparted /dev/sdb print\r\nparted /dev/sdb print >>$LD$LF\r\necho \" blkid \"\r\necho \" blkid \" >>$LD$LF\r\necho \"-------\" >>$LD$LF\r\nblkid\r\nblkid >>$LD$LF\r\necho \" pvs \"\r\necho \" pvs \" >>$LD$LF\r\necho \"-----\" >>$LD$LF\r\npvs\r\npvs >>$LD$LF\r\necho \" vgs \"\r\necho \" vgs \" >>$LD$LF\r\necho \"-----\" >>$LD$LF\r\nvgs\r\nvgs >>$LD$LF\r\necho \" lvs \"\r\necho \" lvs \" >>$LD$LF\r\necho \"-----\" >>$LD$LF\r\nlvs\r\nlvs >>$LD$LF\r\nlvs -a -o +devices\r\nlvs -a -o +devices >>$LD$LF\r\necho \"eerste 2047 sectoren \"\r\necho \"eerste 2047 sectoren \" >>$LD$LF\r\necho \"---------------------\" >>$LD$LF\r\necho \"dd if=/dev/sda of=sda2047.mbr bs=512 count=2047\"\r\necho \"dd if=/dev/sda of=sda2047.mbr bs=512 count=2047\" >>$LD$LF\r\ndd if=/dev/sda of=/myssd2_data/sda2047_${DATUM}.mbr bs=512 count=2047\r\necho \"dd if=/dev/sdb of=sdb2047.mbr bs=512 count=2047\"\r\necho \"dd if=/dev/sdb of=sdb2047.mbr bs=512 count=2047\" >>$LD$LF\r\ndd if=/dev/sdb of=/myssd2_data/sdb2047_${DATUM}.mbr bs=512 count=2047\r\n# echo \"backup vgs\"\r\n# echo \"backup vgs\" >>$LD$LF\r\n# echo \"----------\" >>$LD$LF\r\n# echo \"dd if=/dev/mydell of=mydell.dd\"\r\n# echo \"dd if=/dev/mydell of=mydell.dd >>$LD$LF\r\n# dd if=/dev/mydell of=mydell_${DATUM}.dd\r\n# echo \"dd if=/dev/myssd of=myssd.dd\"\r\n# echo \"dd if=/dev/myssd of=myssd.dd >>$LD$LF\r\n# dd if=/dev/myssd of=myssd_${DATUM}.dd\r\nsync\r\nRES=0\r\nexit $RES\r\n
\r\n\r\n

 

", "db_count": 160 }, { "taaknaam": "Backup van mijn Dell Inspiron op /backup2", "taaktext": "
\r\n#!/bin/bash\r\n# backup op /backup2\r\n# be sure you have at least 6G free on /dev/myssd !!\r\ngrootte=6G\r\ncompress=11\r\nthread=4\r\nfiles=1000\r\nLD=\"/backup2/\"\r\nDIR=\"dir.lst\"\r\nDIR2=\"dir2.lst\"\r\nDATUM=\"$(date +%Y%m%d)\"\r\nLF=backup_$(date +%Y%m%d).out\r\nRES=1\r\n# only run as root\r\nif [ \"$(id -u)\" != '0' ]\r\nthen\r\n        echo \"Deze bash script moet opgestart worden met root rechten\"\r\n        exit $RES\r\nfi\r\necho \"====== start backup ======\" >>$LD$LF\r\necho \"--------------------------\" >>$LD$LF\r\nrm $LD$DIR2 -v >>$LD$LF\r\ncp $LD$DIR $LD$DIR2 -v >>$LD$LF\r\n\r\nCHECKSDC=\"$(lsblk | grep sdc3)\"\r\nCHECKSDB=\"$(lsblk | grep sdb3)\"\r\nCHECKSDA=\"$(lsblk | grep sda3)\"\r\nif [ ! -z \"$CHECKSDA\" ]\r\nthen\r\n  if echo \"$CHECKSDA\" | grep '464,3G'\r\n  then\r\n    SDX1=\"/dev/sda1\"\r\n    SDX2=\"/dev/sda2\"\r\n  fi\r\nfi\r\nif [ ! -z \"$CHECKSDB\" ]\r\nthen\r\n  if echo \"$CHECKSDB\" | grep '464,3G'\r\n  then\r\n    SDX1=\"/dev/sdb1\"\r\n    SDX2=\"/dev/sdb2\"\r\n  fi\r\nfi\r\nif [ ! -z \"$CHECKSDC\" ]\r\nthen\r\n  if echo \"$CHECKSDC\" | grep '464,3G'\r\n  then\r\n    SDX1=\"/dev/sdc1\"\r\n    SDX2=\"/dev/sdc2\"\r\n  fi\r\nfi\r\nRES=2\r\nif [ -z \"$SDX1\" ]\r\nthen\r\n  cp $LD$DIR2 $LD$DIR -v >>$LD$LF\r\n  echo \"exit bash script : RES = $RES\"\r\n  exit $RES\r\nfi\r\n\r\n\r\ncd $LD\r\nTSEC=0\r\nSECONDS=0\r\n# backup boot no logical volume !\r\nbackup=$SDX1\r\nbackup1=/backup2/backup-boot\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\n# lees laatste lijn\r\nline=$(tail -n 1 $LD$DIR)\r\necho \"lijn : $line\"\r\necho \"datum : $DATUM\"\r\nif [ $line == $DATUM ]\r\nthen\r\n\tcp $LD$DIR2 $LD$DIR -v >>$LD$LF\r\n\techo \"deze backup is vandaag al eens gedaan !!  Exit\"\r\n\texit $RES\r\nfi\r\necho $DATUM >>$LD$DIR\r\necho \"datum $DATUM toegevoegd in $DIR\"\r\necho \"datum $DATUM toegevoegd in $DIR\" >>$LD$LF\r\n# lees eerste lijn uit $DIR\r\nline=$(head -n 1 $LD$DIR)\r\necho \"line is $line\"\r\nif [ $line -ne $DATUM ]\r\nthen\r\n   # verwijder alle backups gemaakt op datum $line\r\n   rm -v $LD*$line* >>$LD$LF\r\n  # verwijder de eerste lijn uit $DIR\r\n  sed -i 1d $LD$DIR\r\n   echo \"eerste lijn = $line is uit $LD$DIR\"\r\n   echo \"eerste lijn = $line is uit $LD$DIR\" >>$LD$LF\r\nfi\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\ndf -h $LD >>$LD$LF\r\nSECONDS=0\r\nbackup=$SDX2\r\nbackup1=/backup2/backup-bootefi\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\nSECONDS=0\r\nbackup=/dev/mapper/myssd-root\r\nbackup1=/backup2/backup-root\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \"\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \"  >>$LD$LF\r\nlvcreate -L $grootte -s -n mysnap $backup  >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap  >>$LD$LF\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \"\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \" >>$LD$LF\r\nlvremove -vf /dev/mapper/myssd-mysnap >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\nSECONDS=0\r\nbackup=/dev/mapper/myssd-home\r\nbackup1=/backup2/backup-home\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \"\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \" >>$LD$LF\r\nlvcreate -L $grootte -s -n mysnap $backup  >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap  >>$LD$LF\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \"\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \" >>$LD$LF\r\nlvremove -vf /dev/mapper/myssd-mysnap >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\nSECONDS=0\r\nbackup=/dev/mapper/myssd-data\r\nbackup1=/backup2/backup-data\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \"\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \" >>$LD$LF\r\nlvcreate -L $grootte -s -n mysnap $backup  >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap  >>$LD$LF\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \"\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \" >>$LD$LF\r\nlvremove -vf /dev/mapper/myssd-mysnap >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\nELAPSED=\"Elapsed: $(($TSEC / 3600))hrs $((($TSEC / 60) % 60))min $(($TSEC % 60))sec\"\r\necho \"totale duur = \" $ELAPSED\r\necho \"totale duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \"backup gedaan\" >>$LD$LF\r\necho \"-------------\" >>$LD$LF\r\nls *$DATUM* -la >>$LD$LF\r\necho \"======   end backup dell latitude ======\" >>$LD$LF\r\nsync\r\nRES=0\r\nexit $RES\r\n
\r\n\r\n

 

", "db_count": 164 }, { "taaknaam": "Backup van mijn Dell Inspiron op externe SSD schijf\r\n/myssd2_data", "taaktext": "
\r\n#!/bin/bash\r\n# backup op /myssd2_data\r\n# be sure you have at least 6G free on /dev/myssd !!\r\ngrootte=6G\r\ncompress=11\r\nthread=4\r\nfiles=1000\r\nLD=\"/myssd2_data/\"\r\nDIR=\"dir.lst\"\r\nDIR2=\"dir2.lst\"\r\nDATUM=\"$(date +%Y%m%d)\"\r\nLF=backup_$(date +%Y%m%d).out\r\nRES=1\r\n# only run as root\r\nif [ \"$(id -u)\" != '0' ]\r\nthen\r\n        echo \"Deze bash script moet opgestart worden met root rechten\"\r\n        exit $RES\r\nfi\r\necho \"====== start backup ======\" >>$LD$LF\r\necho \"--------------------------\" >>$LD$LF\r\nrm $LD$DIR2 -v >>$LD$LF\r\ncp $LD$DIR $LD$DIR2 -v >>$LD$LF\r\n\r\nCHECKSDC=\"$(lsblk | grep sdc3)\"\r\nCHECKSDB=\"$(lsblk | grep sdb3)\"\r\nCHECKSDA=\"$(lsblk | grep sda3)\"\r\nif [ ! -z \"$CHECKSDA\" ]\r\nthen\r\n  if echo \"$CHECKSDA\" | grep '464,3G'\r\n  then\r\n    SDX1=\"/dev/sda1\"\r\n    SDX2=\"/dev/sda2\"\r\n  fi\r\nfi\r\nif [ ! -z \"$CHECKSDB\" ]\r\nthen\r\n  if echo \"$CHECKSDB\" | grep '464,3G'\r\n  then\r\n    SDX1=\"/dev/sdb1\"\r\n    SDX2=\"/dev/sdb2\"\r\n  fi\r\nfi\r\nif [ ! -z \"$CHECKSDC\" ]\r\nthen\r\n  if echo \"$CHECKSDC\" | grep '464,3G'\r\n  then\r\n    SDX1=\"/dev/sdc1\"\r\n    SDX2=\"/dev/sdc2\"\r\n  fi\r\nfi\r\nRES=2\r\nif [ -z \"$SDX1\" ]\r\nthen\r\n  cp $LD$DIR2 $LD$DIR -v >>$LD$LF\r\n  echo \"exit bash script : RES = $RES\"\r\n  exit $RES\r\nfi\r\n\r\ncd $LD\r\nTSEC=0\r\nSECONDS=0\r\n# backup boot no logical volume !\r\nbackup=$SDX1\r\nbackup1=/myssd2_data/backup-boot\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\n# lees laatste lijn\r\nline=$(tail -n 1 $LD$DIR)\r\necho \"lijn : $line\"\r\necho \"datum : $DATUM\"\r\nif [ $line == $DATUM ]\r\nthen\r\n\tcp $LD$DIR2 $LD$DIR -v >>$LD$LF\r\n\techo \"deze backup is vandaag al eens gedaan !!  Exit\"\r\n\texit $RES\r\nfi\r\necho $DATUM >>$LD$DIR\r\necho \"datum $DATUM toegevoegd in $DIR\"\r\necho \"datum $DATUM toegevoegd in $DIR\" >>$LD$LF\r\n# lees eerste lijn uit $DIR\r\nline=$(head -n 1 $LD$DIR)\r\necho \"line is $line\"\r\nif [ $line -ne $DATUM ]\r\nthen\r\n   # verwijder alle backups gemaakt op datum $line\r\n   rm -v $LD*$line* >>$LD$LF\r\n  # verwijder de eerste lijn uit $DIR\r\n  sed -i 1d $LD$DIR\r\n   echo \"eerste lijn = $line is uit $LD$DIR\"\r\n   echo \"eerste lijn = $line is uit $LD$DIR\" >>$LD$LF\r\nfi\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\ndf -h $LD >>$LD$LF\r\nSECONDS=0\r\nbackup=$SDX2\r\nbackup1=/myssd2_data/backup-bootefi\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\nSECONDS=0\r\nbackup=/dev/mapper/myssd-root\r\nbackup1=/myssd2_data/backup-root\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \"\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \"  >>$LD$LF\r\nlvcreate -L $grootte -s -n mysnap $backup  >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap  >>$LD$LF\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \"\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \" >>$LD$LF\r\nlvremove -vf /dev/mapper/myssd-mysnap >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\nSECONDS=0\r\nbackup=/dev/mapper/myssd-home\r\nbackup1=/myssd2_data/backup-home\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \"\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \" >>$LD$LF\r\nlvcreate -L $grootte -s -n mysnap $backup  >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap  >>$LD$LF\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \"\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \" >>$LD$LF\r\nlvremove -vf /dev/mapper/myssd-mysnap >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\nSECONDS=0\r\nbackup=/dev/mapper/myssd-data\r\nbackup1=/myssd2_data/backup-data\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"backup \" $backup >>$LD$LF\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \"\r\necho \" lvcreate -L $grootte -s -n mysnap $backup \" >>$LD$LF\r\nlvcreate -L $grootte -s -n mysnap $backup  >>$LD$LF\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\"\r\necho \" fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap\" >>$LD$LF\r\nfsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap  >>$LD$LF\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \"\r\necho \" lvremove -vf /dev/mapper/myssd-mysnap \" >>$LD$LF\r\nlvremove -vf /dev/mapper/myssd-mysnap >>$LD$LF\r\nls $backup1-$TIMESTAMP.* -la >>$LD$LF\r\nELAPSED=\"Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec\"\r\necho \"duur = \" $ELAPSED\r\necho \"duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTSEC=$(($TSEC + $SECONDS))\r\nELAPSED=\"Elapsed: $(($TSEC / 3600))hrs $((($TSEC / 60) % 60))min $(($TSEC % 60))sec\"\r\necho \"totale duur = \" $ELAPSED\r\necho \"totale duur = \" $ELAPSED >>$LD$LF\r\ndf -h $LD >>$LD$LF\r\nTIMESTAMP=\"$(date +%Y%m%d-%Hh%M)\"\r\necho \"TIMESTAMP \" $TIMESTAMP >>$LD$LF\r\necho \"backup gedaan\" >>$LD$LF\r\necho \"-------------\" >>$LD$LF\r\nls *$DATUM* -la >>$LD$LF\r\necho \"======   end backup dell latitude ======\" >>$LD$LF\r\nsync\r\nRES=0\r\nexit $RES\r\n
\r\n

 

", "db_count": 169 }, { "taaknaam": "Budget_Beheer", "taaktext": "
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n

budget_beheer.md

\r\n
\r\n
\r\n\r\n
\r\n
\r\n

titel: "Budget_Beheer"

\r\n\r\n

beschrijving: "bootloader van systemd"

\r\n\r\n

categoriën:

\r\n\r\n
    \r\n\t
  • docker
  • \r\n\t
  • container
  • \r\n\t
  • sqlite3
  • \r\n\t
  • budget
  • \r\n
\r\n\r\n
\r\n

Mijn Budget Beheer

\r\n\r\n

Ophalen image van Docker hub website

\r\n\r\n
\r\n
\r\ndocker pull ulefr01/budget:latest
\r\n
\r\n\r\n

uitvoeren

\r\n\r\n
\r\n
\r\n# maak dat poort 80 vrij is ; sudo systemctl stop apache2.service\r\ndocker run -p 80:80 ulefr01/budget
\r\n
\r\n\r\n

Start BudgetBeheer in je browser http://0.0.0.0:80

\r\n\r\n
    \r\n\t
  • inloggen met user = test
  • \r\n\t
  • wachtwoord = test
  • \r\n
\r\n\r\n

Noot:

\r\n\r\n
    \r\n\t
  • je kunt geen uitgave doen als er geen rekeningen bestaan !
  • \r\n\t
  • Creëer rekeningen als volgt:\r\n\t
      \r\n\t\t
    • rek000 Start bedrag=0 type=start user=test
    • \r\n\t\t
    • rek002 Kbc Zichtrekening bedrag=0 type=bezit user=test
    • \r\n\t\t
    • rek500 Salaris bedrag=0 type=inkomen user=test
    • \r\n\t\t
    • rek510 Boodschappen bedrag=0 type=uitgave user=test
    • \r\n\t\t
    • rek520 Nuts facturen bedrag=0 type=uitgave user=test
    • \r\n\t
    \r\n\t
  • \r\n\t
  • Creëer uitgave(transactie knop 'Nieuwe Uitgave()) als volgt:\r\n\t
      \r\n\t\t
    • van rek = rek000, naar rek = rek002, bedrag= 2000, user=test, beschrijving=start bedrag zichtrekening 2000 € druk op knop 'nieuwe uitgave' om de transactie te doen
    • \r\n\t
    \r\n\t
  • \r\n\t
  • Creëer een nieuwe uitgave(transactie knop 'Nieuwe Uitgave()) je ziet nu in de lijst uigaven je eerste transactie\r\n\t
      \r\n\t\t
    • van rek = rek500, naar rek = rek002, bedrag = 1500, user=test, beschrijving=mijn salaris 1500 € druk op knop 'nieuwe uitgave' om de transactie te doen je ziet nu in de lijst uigaven al je transacties
    • \r\n\t
    \r\n\t
  • \r\n\t
  • druk op 'Rekeningen' je ziet rek000 start bedrag -2000 rek002 Kbc Zichtrekening bedrag 3500 rek500 salaris -1500 rek510 Boodschappen 0 rek520 Nuts facturen 0
  • \r\n\t
  • Creëer een nieuwe uitgave(transactie knop 'Nieuwe Uitgave())\r\n\t
      \r\n\t\t
    • van rek = rek510, naar rek = rek002, bedrag = -250, user=test, beschrijving=boodschappen -250 € druk op knop 'nieuwe uitgave' om de transactie te doen je ziet nu in de lijst uigaven al je transacties
      \r\n\t\t(de recentste uitgaven worden eerst getoond dan de oudere)
    • \r\n\t
    \r\n\t
  • \r\n\t
  • enzovoort
  • \r\n
\r\n\r\n

Start BudgetBeheer in django admin mode met http://0.0.0.0:80/admin

\r\n\r\n
    \r\n\t
  • inloggen met user = test
  • \r\n\t
  • wachtwoord = test
  • \r\n
\r\n\r\n

Starten in fish

\r\n\r\n
\r\n
\r\ndocker run -it -p 80:80 budget /usr/bin/fish
\r\n
\r\n\r\n

Uitgaven Lijst

\r\n\r\n

Knop 'Niewe Uitgave'

\r\n\r\n

Dient om een nieuwe transactie te maken

\r\n\r\n

Kolom 'Id'

\r\n\r\n

Op ieder rij kun je iedere transactie aanpassen en/of wegdoen door op het 'Idnummer' te klikken.

\r\n\r\n

Rekeningen Lijst

\r\n\r\n

Laatste totalen van je rekeningen

\r\n\r\n

Op de Rekeningen Lijst kun je de laatste totalen zien per Rekening.

\r\n\r\n

Rekening aanpassen en/of wegdoen

\r\n\r\n

Op de Rekeningen Lijst kun je door op het Id te drukken de Rekening aanpassen en/of zelfs wegdoen.

\r\n\r\n

Unload-reload database principe is mogelijk als volgt :

\r\n\r\n

1. run_export

\r\n\r\n

exporteer database naar json bestanden

\r\n\r\n
\r\n
\r\n./manage.py run_export
\r\n
\r\n\r\n
uitvoer van run_export
\r\n\r\n
\r\n
\r\n/usr/xptracker/xptracker\r\nFunction : rekeningen_list\r\nNumber of Queries : 55\r\nFinished in : 0.04s\r\nFunction : transacties_list\r\nNumber of Queries : 1384\r\nFinished in : 0.80s\r\nFunction : users_list\r\nNumber of Queries : 1\r\nFinished in : 0.00s
\r\n
\r\n\r\n

maak van json bestanden text bestanden

\r\n\r\n
\r\n
\r\n./manage.py uitvoer_json_txt
\r\n
\r\n\r\n
uitvoer ziet er als volgt uit :
\r\n\r\n
\r\n
\r\n/usr/xptracker/xptracker\r\njq . rekeningen_list.json >rekeningen_list.txt\r\njq . transacties_list.json >transacties_list.txt\r\njq . users_list.json >users_list.txt\r\n-rw-r--r-- 1 root root  10058 Sep 24 20:06 rekeningen_list.txt\r\n-rw-r--r-- 1 root root    915 Mar 18  2022 requirements.txt\r\n-rw-r--r-- 1 root root   7513 Mar 18  2022 show_urls.txt\r\n-rw-rw-r-- 1 root root 119766 Sep 24 20:06 transacties_list.txt\r\n-rw-rw-r-- 1 root root    403 Sep 24 20:06 users_list.txt
\r\n
\r\n\r\n

2. Opkuis sql database

\r\n\r\n
\r\n
\r\n./manage.py init_items
\r\n
\r\n\r\n
uitvoer ziet er zo uit :
\r\n\r\n
\r\n
\r\n/usr/xptracker/xptracker\r\ndelete.sql is uitgevoerd\r\nset_sequence_0.sql is uitgevoerd
\r\n
\r\n\r\n

3. run_import

\r\n\r\n

importeer gegevens vanaf json bestanden

\r\n\r\n
\r\n
\r\n./manage.py run_import
\r\n
\r\n\r\n
uitvoer ziet er zo uit :
\r\n\r\n
\r\n
\r\n/usr/xptracker/xptracker
\r\n
\r\n\r\n

Ophalen/Wijzigen/Terugzetten van je sql database

\r\n\r\n
    \r\n\t
  • \r\n\t

    Download Sql database db.sqlite3 op ~/Downloads/db.sqlite3

    \r\n\r\n\t

    check het container id (=je_id) van je docker containers

    \r\n\t
  • \r\n
\r\n\r\n
\r\n
\r\n    #/bin/bash\r\n    # wijzig 'je_id' naar je docker container_id\r\n    docker cp 'je_id':/usr/xptracker/xptracker/db.sqlite3 . \r\n    echo "downld db.sqlite3 op container je_id gedaan"\r\n    exit 0
\r\n
\r\n\r\n
    \r\n\t
  • Wijzig desnoods db.sqlite3 database
  • \r\n
\r\n\r\n
\r\n
\r\n    sqlitebrowser db.sqlite3
\r\n
\r\n\r\n
    \r\n\t
  • Terugzetten database naar een docker container Check het container id (kan desnoods een ander id zijn ivgl met vorig id) (=nieuw_id) van je docker containers
  • \r\n
\r\n\r\n
\r\n
\r\n    #/bin/bash\r\n    docker cp ~/Downloads/db.sqlite3 'nieuw_id':/usr/xptracker/xptracker/. \r\n    echo "copy db.sqlite3 op container nieuw_id06 gedaan"\r\n    rm ~/Downloads/db.sqlite3 -v\r\n    exit 0
\r\n
\r\n\r\n

opmerkingen

\r\n\r\n

Je kan je opmerkingen kwijt op mijn email adres : franz.ulenaers@telenet.be

\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n

 

", "db_count": 101 }, { "taaknaam": "Cryfs heropmaken", "taaktext": "

cryfs heropmaken

\r\n\r\n
\r\n

mkdir /data/Decrypt2 /data/Encrypt2

\r\n\r\n

cryfs /data/Encrypt2 /data/Decrypt2
\r\n                    fill in password 2x     zie Bitwarden
\r\n    
\r\ncp -rv /data/Decrypt/* /data/Decrypt2/
\r\ncp -rv /data/Decrypt/.* /data/Decrypt2/       

\r\n\r\n

fusermount -u  /data/Decrypt

\r\n\r\n

mv /data/Encrypt /data/Encrypt3

\r\n\r\n

mkdir /data/Encrypt  /data/Decrypt

\r\n\r\n

    (  chown ulefr01:ulefr01 /data/Decrypt  )

\r\n\r\n


\r\ncryfs /data/Encrypt /data/Decrypt
\r\n        fill in password 2x     zie bitwarden

\r\n\r\n

cp -rv /data/Decrypt2/* /data/Decrypt/
\r\ncp -rv /data/Decrypt2/.* /data/Decrypt/

\r\n\r\n

cryfs-unmount /data/Decrypt2

\r\n\r\n

cryfs-unmount /data/Decrypt

\r\n\r\n

rmdir /data/Decrypt2
\r\nrm -rv /data/Encrypt2/

\r\n
\r\n\r\n

cryfs automount

\r\n\r\n
\r\n

cryfs-automount  cryfsauto  -b  /data/Encrypt  -m /data/Decrypt   -p hetwachtwoord

\r\n\r\n

 

\r\n
\r\n\r\n

reboot
\r\n 

", "db_count": 171 }, { "taaknaam": "Cryfs mount probleem", "taaktext": "

Cryfs mount probleem

\r\n\r\n
\r\n

rm -r /data/Decrypt

\r\n\r\n

mkdir /data/Decrypt

\r\n\r\n

cryfs /data/Encrypt  /data/Decrypt

\r\n\r\n

        vul in  2x paswoord

\r\n\r\n

                bij problemen : 

\r\n\r\n

                    rm  -r  /data/Decrypt/

\r\n\r\n

                    mkdir /data/Decrypt

\r\n\r\n

                    cryfs  /data/Encrypt    /data/Decrypt

\r\n\r\n

 

\r\n
\r\n\r\n

 

", "db_count": 140 }, { "taaknaam": "Django Tips", "taaktext": "

django tips

\r\n\r\n

Here we go:

\r\n\r\n

1. Correct Model Naming

\r\n\r\n

It is generally recommended to use singular nouns for model naming, for example: User, Post, Article. That is, the last component of the name should be a noun, e.g.: Some New Shiny Item. It is correct to use singular numbers when one unit of a model does not contain information about several objects.

\r\n\r\n

2. Relationship Field Naming

\r\n\r\n

For relationships such as ForeignKey, OneToOneKey, ManyToMany it is sometimes better to specify a name. Imagine there is a model called Article, - in which one of the relationships is ForeignKey for model User. If this field contains information about the author of the article, then author will be a more appropriate name than user.

\r\n\r\n

3. Correct Related-Name

\r\n\r\n

It is reasonable to indicate a related-name in plural as related-name addressing returns queryset. Please, do set adequate related-names. In the majority of cases, the name of the model in plural will be just right. For example:

\r\n\r\n

class Owner(models.Model):

\r\n\r\n

pass

\r\n\r\n

class Item(models.Model):

\r\n\r\n

owner = models.ForeignKey(Owner, related_name='items')

\r\n\r\n

4. Do not use ForeignKey with unique=True

\r\n\r\n

There is no point in using ForeignKey with unique=Trueas there exists OneToOneField for such cases.

\r\n\r\n

5. Attributes and Methods Order in a Model

\r\n\r\n

Preferable attributes and methods order in a model (an empty string between the points).

\r\n\r\n

constants (for choices and other)
\r\nfields of the model
\r\ncustom manager indication
\r\nmeta
\r\ndef unicode (python 2) or def str (python 3)
\r\nother special methods
\r\ndef clean
\r\ndef save
\r\ndef get_absolut_url
\r\nother methods
\r\nPlease note that the given order was taken from documentations and slightly expanded.

\r\n\r\n

6. Adding a Model via Migration

\r\n\r\n

If you need to add a model, then, having created a class of a model, execute serially manage.py commands makemigrations and migrate (or use South for Django 1.6 and below).

\r\n\r\n

7. Denormalisations

\r\n\r\n

You should not allow thoughtless use of denormalization in relational databases. Always try to avoid it, except for the cases when you denormalise data consciously for whatever the reason may be (e.g. productivity). If at the stage of database designing you understand that you need to denormalise much of the data, a good option could be the use of NoSQL. However, if most of data does not require denormalisation, which cannot be avoided, think about a relational base with JsonField to store some data.

\r\n\r\n

8. BooleanField

\r\n\r\n

Do not use null=True or blank=True for BooleanField. It should also be pointed out that it is better to specify default values for such fields. If you realise that the field can remain empty, you need NullBooleanField.

\r\n\r\n

9. Business Logic in Models

\r\n\r\n

The best place to allocate business logic for your project is in models, namely method models and model manager. It is possible that method models can only provoke some methods/functions. If it is inconvenient or impossible to allocate logic in models, you need to replace its forms or serializers in tasks.

\r\n\r\n

10. Field Duplication in ModelForm

\r\n\r\n

Do not duplicate model fields in ModelForm or ModelSerializer without need. If you want to specify that the form uses all model fields, use MetaFields. If you need to redefine a widget for a field with nothing else to be changed in this field, make use of Meta widgets to indicate widgets.

\r\n\r\n

11. Do not use ObjectDoesNotExist

\r\n\r\n

Using ModelName.DoesNotExist instead of ObjectDoesNotExist makes your exception intercepting more specialised, which is a positive practice.

\r\n\r\n

12. Use of choices

\r\n\r\n

While using choices, it is recommended to:

\r\n\r\n

keep strings instead of numbers in the database (although this is not the best option from the point of optional database use, it is more convenient in practise as strings are more demonstrable, which allows the use of clear filters with get options from the box in REST frameworks).
\r\nvariables for variants storage are constants. That is why they must be indicated in uppercase.
\r\nindicate the variants before the fields lists.
\r\nif it is a list of the statuses, indicate it in chronological order (e.g. new, in_progress, completed).
\r\nyou can use Choices from the model_utils library. Take model Article, for instance:
\r\nfrom model_utils import Choices

\r\n\r\n

class Article(models.Model):

\r\n\r\n

STATUSES = Choices(

\r\n\r\n

(0, 'draft', _('draft')),
\r\n(1, 'published', _('published')) )

\r\n\r\n

status = models.IntegerField(choices=STATUSES, default=STATUSES.draft)
\r\n…

\r\n\r\n

 

\r\n\r\n

13. Why do you need an extra .all()?

\r\n\r\n

Using ORM, do not add an extra method call all before filter(), count(), etc.

\r\n\r\n

14. Many flags in a model?

\r\n\r\n

If it is justified, replace several BooleanFields with one field, status-like. e.g.

\r\n\r\n

class Article(models.Model):

\r\n\r\n

is_published = models.BooleanField(default=False)
\r\nis_verified = models.BooleanField(default=False)
\r\n…

\r\n\r\n

Assume the logic of our application presupposes that the article is not published and checked initially, then it is checked and marked is_verified in True and then it is published. You can notice that article cannot be published without being checked. So there are 3 conditions in total, but with 2 boolean fields we do not have 4 possible variants, and you should make sure there are no articles with wrong boolean fields conditions combinations. That is why using one status field instead of two boolean fields is a better option:

\r\n\r\n

 

\r\n\r\n

class Article(models.Model):

\r\n\r\n

STATUSES = Choices('new', 'verified', 'published')

\r\n\r\n

 

\r\n\r\n

 

\r\n\r\n

status = models.IntegerField(choices=STATUSES, default=STATUSES.draft)
\r\n…

\r\n\r\n

This example may not be very illustrative, but imagine that you have 3 or more such boolean fields in your model, and validation control for these field value combinations can be really tiresome.

\r\n\r\n

 

\r\n\r\n

15. Redundant model name in a field name

\r\n\r\n

Do not add model names to fields if there is no need to do so, e.g. if table User has a field user_status - you should rename the field into status, as long as there are no other statuses in this model.

\r\n\r\n

16. Dirty data should not be found in a base

\r\n\r\n

Always use PositiveIntegerField instead of IntegerField if it is not senseless, because “bad” data must not go to the base. For the same reason you should always use unique,unique_together for logically unique data and never use required=False in every field.

\r\n\r\n

17. Getting the earliest/latest object

\r\n\r\n

You can use ModelName.objects.earliest('created'/'earliest') instead of order_by('created')[0] and you can also put get_latest_by in Meta model. You should keep in mind that latest/earliest as well as get can cause an exception DoesNotExist. Therefore, order_by('created').first() is the most useful variant.

\r\n\r\n

18. Never make len(queryset)

\r\n\r\n

Do not use len to get queryset’s objects amount. The count method can be used for this purpose. Like this: len(ModelName.objects.all()), firstly the query for selecting all data from the table will be carried out, then this data will be transformed into a Python object, and the length of this object will be found with the help of len. It is highly recommended not to use this method as count will address to a corresponding SQL function COUNT(). With count, an easier query will be carried out in that database and fewer resources will be required for python code performance.

\r\n\r\n

19. if queryset is a bad idea

\r\n\r\n

Do not use queryset as a boolean value: instead of if queryset: do something use if queryset.exists(): do something. Remember, that querysets are lazy, and if you use queryset as a boolean value, an inappropriate query to a database will be carried out.

\r\n\r\n

20. Using help_text as documentation

\r\n\r\n

Using model help_text in fields as a part of documentation will definitely facilitate the understanding of the data structure by you, your colleagues, and admin users.

\r\n\r\n

21. Money Information Storage

\r\n\r\n

Do not use FloatField to store information about the quantity of money. Instead, use DecimalField for this purpose. You can also keep this information in cents, units, etc.

\r\n\r\n

22. Don't use null=true if you don't need it

\r\n\r\n

null=True - Allows column to keep null value.

\r\n\r\n

blank=True - Will be used only if Forms for validation and not related to the database.

\r\n\r\n

In text-based fields, it's better to keep default value.

\r\n\r\n

blank=True

\r\n\r\n

default=''

\r\n\r\n

This way you'll get only one possible value for columns without data.

\r\n\r\n

23. Remove _id

\r\n\r\n

Do not add _id suffix to ForeignKeyField and OneToOneField.

\r\n\r\n

24. Define __unicode__ or __str__

\r\n\r\n

In all non abstract models, add methods unicode(python 2) or str(python 3). These methods must always return strings.

\r\n\r\n

25. Transparent fields list

\r\n\r\n

Do not use Meta.exclude for a model’s fields list description in ModelForm. It is better to use Meta.fields for this as it makes the fields list transparent. Do not use Meta.fields=”all” for the same reason.

\r\n\r\n

26. Do not heap all files loaded by user in the same folder

\r\n\r\n

Sometimes even a separate folder for each FileField will not be enough if a large amount of downloaded files is expected. Storing many files in one folder means the file system will search for the needed file more slowly. To avoid such problems, you can do the following:

\r\n\r\n

def get_upload_path(instance, filename):

\r\n\r\n

return os.path.join('account/avatars/', now().date().strftime("%Y/%m/%d"), filename)

\r\n\r\n

 

\r\n\r\n

class User(AbstractUser):

\r\n\r\n

avatar = models.ImageField(blank=True, upload_to=get_upload_path)

\r\n\r\n

 

\r\n\r\n

27. Use abstract models

\r\n\r\n

If you want to share some logic between models, you can use abstract models.

\r\n\r\n

class CreatedatModel(models.Model):

\r\n\r\n

created_at = models.DateTimeField(

\r\n\r\n

verbose_name=u"Created at",

\r\n\r\n

auto_now_add=True

\r\n\r\n

)

\r\n\r\n

class Meta:

\r\n\r\n

abstract = True

\r\n\r\n

class Post(CreatedatModel):

\r\n\r\n

...

\r\n\r\n

class Comment(CreatedatModel):

\r\n\r\n

...

\r\n\r\n

28. Use custom Manager and QuerySet

\r\n\r\n

The bigger project you work on, the more you repeat the same code in different places.

\r\n\r\n

To keep your code DRY and allocate business logic in models, you can use custom Managers and Queryset.

\r\n\r\n

For example. If you need to get comments count for posts, from the example above.

\r\n\r\n

class CustomManager(models.Manager):

\r\n\r\n

def with_comments_counter(self):

\r\n\r\n

return self.get_queryset().annotate(comments_count=Count('comment_set'))

\r\n\r\n

Now you can use:

\r\n\r\n

 

\r\n\r\n

posts = Post.objects.with_comments_counter()

\r\n\r\n

posts[0].comments_count

\r\n\r\n

If you want to use this method in chain with others queryset methods,

\r\n\r\n

you should use custom QuerySet:

\r\n\r\n

class CustomQuerySet(models.query.QuerySet):

\r\n\r\n

"""Substitution the QuerySet, and adding additional methods to QuerySet

\r\n\r\n

"""

\r\n\r\n

def with_comments_counter(self):

\r\n\r\n

"""

\r\n\r\n

Adds comments counter to queryset

\r\n\r\n

"""

\r\n\r\n

return self.annotate(comments_count=Count('comment_set'))

\r\n\r\n

Now you can use:

\r\n\r\n

posts = Post.objects.filter(...).with_comments_counter()

\r\n\r\n

posts[0].comments_count

", "db_count": 133 }, { "taaknaam": "Django starten nieuw(bestaand) project", "taaktext": "

Django starten van een nieuw (of een bestaand) project

\r\n\r\n

te gebruiken tool voor de creatie van de virtuele omgeving

\r\n\r\n

bij gebruik van de fish shell

\r\n\r\n

    eenmalig :  installeer vf (virtualfish)

\r\n\r\n
\r\n

        sudo pip install virtualfish

\r\n
\r\n\r\n

    eenmalig : creeer de functie : fish_prompt.fish 

\r\n\r\n

~/.config/fish/functions/fish_prompt.fish

\r\n\r\n
\r\n

if set -q VIRTUAL_ENV

\r\n\r\n

echo -n -s (set color -b blue white) "(" (basename "$VIRTUAL_ENV") ")" (set color normal) " "

\r\n\r\n

end

\r\n
\r\n\r\n
\r\n

vf opties :

\r\n\r\n

Usage: vf <command> [<args>]

\r\n\r\n

Available commands:

\r\n\r\n

    activate        Activate a virtualenv
\r\n    addpath         Adds a path to sys.path in this virtualenv
\r\n    addplugins      Install one or more plugins
\r\n    all             Run a command in all virtualenvs sequentially
\r\n    cd              Change directory to this virtualenv
\r\n    cdpackages      Change to the site-packages directory of this virtualenv
\r\n    cdproject       Change working directory to project directory
\r\n    connect         Connect this virtualenv to the current directory
\r\n    deactivate      Deactivate this virtualenv
\r\n    environment     Edit the environment variables for the active virtual environment
\r\n    globalpackages  Manage global site packages
\r\n    help            Print VirtualFish usage information
\r\n    install         Install VirtualFish
\r\n    ls              List all available virtual environments
\r\n    lsprojects      List projects
\r\n    new             Create a new virtualenv
\r\n    project         Create a new project and virtualenv with the name provided
\r\n    rm              Delete one or more virtual environments
\r\n    rmplugins       Remove one or more plugins
\r\n    tmp             Create a virtualenv that will be removed when deactivated
\r\n    uninstall       Uninstall VirtualFish
\r\n    upgrade         Upgrade virtualenv(s) to newer Python version
\r\n    workon          Work on a project

\r\n 

\r\n
\r\n\r\n

andere tools kunnen ook gebruikt worden zoals : 

\r\n\r\n

    pipenv

\r\n\r\n

    mkvirtualenv

\r\n\r\n

    ....

\r\n\r\n

namen te bepalen

\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n
mijn_project_naamfoldernaam van het project
django_project_naam bevat normaal db.sqlite3, settings,  media, static, log en templates mappen
bijkomende_app_naameen project kan verschillende apps hebben
\r\n\r\n

starten

\r\n\r\n
\r\n

mkdir /data/mijn_project_naam
\r\ncd /data/mijn_project_naam
\r\natom ./

\r\n
\r\n\r\n

    maak gebruik van een django template : hier maak ik gebruik van mijn eigen gemaakte  template django-project-template uit  mijn Downloads map

\r\n\r\n
\r\n

django-admin startproject --template ~/Downloads/django-project-template django_project_naam  .

\r\n
\r\n\r\n

    creatie van een nieuwe virtuele omgeving voor je django project 

\r\n\r\n
\r\n

vf  new  env_django_project_naam  -p  python3.8

\r\n
\r\n\r\n

    activeer je virtuele omgeving (eenmalig ofwel volledig buitem atom ofwel volledig binnen atom)

\r\n\r\n
\r\n

vf  activate  env_django_project_naam

\r\n
\r\n\r\n

 

\r\n\r\n

    installeer reeks python pakketten uit bestand = requirements.txt (eenmalig)

\r\n\r\n
\r\n

pip install -r requirements.txt

\r\n
\r\n\r\n


\r\n    installeer indien nodig bijkomende pakket xyz

\r\n\r\n
\r\n

pip install xyz

\r\n
\r\n\r\n

    bepalen welke pakketten in je virtuele omgeving geinstalleerd zijn :

\r\n\r\n
\r\n

pip freeze

\r\n
\r\n\r\n

    al je geinstalleerde pakketten onthouden

\r\n\r\n
\r\n

pip freeze >requirements.txt

\r\n
\r\n\r\n
\r\n

./manage.py  migrate
\r\n./manage.py  createsuperuser
\r\n./manage.py  runserver  /  runserver_plus

\r\n
\r\n\r\n

    voor iedere bijkomende app

\r\n\r\n
\r\n

./manage-py  startapp  bijkomende_app_naam

\r\n
\r\n\r\n


\r\n    als app komt van een bestaande django site (na download zip naar /data/tmp/ en unzip)

\r\n\r\n

    maak gebruik van  bash procedures :  ../tmp/project_accounts , ../tmp/project_app , ../tmp/project_media , ../tmp/project_static , ../tmp/project_templates

\r\n\r\n
\r\n

.. / tmp / project_app  mijn_project_naam   app_naam   .
\r\n.. / tmp / project_app  
mijn_project_naam base   .

\r\n
\r\n\r\n

    settings/base.py

\r\n\r\n
\r\n

INSTALLED_APPS = [

\r\n\r\n

'app_naam' ,

\r\n\r\n

]

\r\n
\r\n\r\n

    starten website 

\r\n\r\n
\r\n

./manage-py  makemigrations

\r\n
\r\n\r\n

        (pas .... initial.py aan als volgorde veldnamen in de modellen gewijzigd is ; dit om problemen bij oplading gegevens te vermijden)

\r\n\r\n
\r\n

./manage-py  migrate
\r\n./manage-py  runserver

\r\n
\r\n\r\n


\r\n        sitemaps ?
\r\n        als bestaande media , static en templates moet overgenomen worden

\r\n\r\n
\r\n

../tmp/ project_media site_project_naam mijn_project_naam .
\r\n../tmp/ project_static site_project_naam mijn_project_naam .
\r\n../tmp/ project_templates site_project_naam mijn_project_naam .

\r\n
\r\n\r\n
\r\n

./manage-py runserver_plus

\r\n
\r\n\r\n

 

\r\n\r\n
\r\n

./manage-py show_urls
\r\n./manage-py shell_plus -ipython
\r\n./manage-py shell_plus -bpython
\r\n./manage-py graph_models auth -o auth.png
\r\n./manage-py graph_models app -o app.png
\r\n./manage-py graph_models -a -o all.png
\r\n./manage-py findstatic --verbosity 2 land/bootstrap/css/bootstrap.min.css
\r\n./manage-py find_template registration/password_reset_form.html
\r\n./manage-py collectstatic
\r\n./manage-py ping_google sitemap.xml

\r\n
\r\n\r\n

    app_naam/management/commands   map

\r\n\r\n

        exporteer 

\r\n\r\n
\r\n

./manage.py  run_export

\r\n
\r\n\r\n

        initializeer

\r\n\r\n
\r\n

./manage.py  init_items 

\r\n
\r\n\r\n

        importeer

\r\n\r\n
\r\n

./manage.py  run_import

\r\n
\r\n\r\n

        init_items.py  kan ook  sql statements uitvoeren

\r\n\r\n

 

\r\n\r\n

   deactiveer  virtuele omgeving

\r\n\r\n
\r\n

vf   deactivate

\r\n
\r\n\r\n

   ping_google

\r\n\r\n
\r\n

./manage.py  ping_google  sitemap.xml

\r\n
\r\n\r\n

    

\r\n\r\n

  google search console

\r\n\r\n

  google analytics 

\r\n\r\n

 

", "db_count": 114 }, { "taaknaam": "Fstab Dell Inspiron 15 5559", "taaktext": "

# /etc/fstab: static file system information.
\r\n#
\r\n# Use 'blkid' to print the universally unique identifier for a
\r\n# device; this may be used with UUID= as a more robust way to name devices
\r\n# that works even if disks are added and removed. See fstab(5).
\r\n#
\r\n# systemd generates mount units based on this file, see systemd.mount(5).
\r\n# Please run 'systemctl daemon-reload' after making changes here.
\r\n#
\r\n# <file system> <mount point>   <type>  <options>       <dump>  <pass>
\r\n# /dev/mapper/myssd-root /               ext4    errors=remount-ro 0       1
\r\nUUID="0d8f82d3-9635-4e9c-8f6e-1512f4e1b2d6"    /               ext4    discard,noatime,data=writeback,commit=60,errors=remount-ro    0       1
\r\n# /boot was on /dev/sda1 during installation
\r\nUUID=76eff931-f5b2-4593-915f-d8b22e26b675    /boot           ext4    defaults,noatime,data=writeback,commit=60    0       2
\r\n# /boot/efi was on /dev/sda2 during installation
\r\nUUID=375C-2F09                    /boot/efi       vfat    umask=0077            0       1
\r\n# /dev/mapper/myssd-data /data           ext4    discard,noatime,nodiratime 0       2
\r\nUUID="2c66bdba-e26c-401d-bf8c-dc304db8b2f2"    /data           ext4    discard,noatime,data=writeback,commit=60    0       2
\r\n# /dev/mapper/myssd-home /home           ext4    discard,noatime,nodiratime 0       2
\r\nUUID="2b855259-d2e5-401a-a208-d7d6becaa566"    /home           ext4    discard,noatime,data=writeback,commit=60    0       2
\r\n#
\r\n# /dev/mapper/mydell-backup   /backup   ext4    noauto,user,noatime     0       2
\r\nUUID=f121a365-44da-46f1-bd6e-eed4f26109fe    /backup        ext4    user,noatime,data=writeback,commit=60,exec    0       2
\r\n/backup/swapfile                none        swap            sw,discard        0       0
\r\n# /dev/mapper/mydell-backup2  /backup2  ext4    noauto,user,noatime     0       2
\r\nUUID=bc41856b-bace-4235-9e9e-ee49ffb83ea8    /backup2    ext4    noauto,user,noatime,data=writeback,commit=600,exec 0      0
\r\n/dev/sr0                    /media/cdrom0   udf,iso9660 user,noauto     0       0
\r\n# binds
\r\n/data                        /home/ulefr01/data    none bind
\r\n#
\r\n# /dev/sdb1 is oude /boot/efi
\r\n# /dev/sdb3     /media/ulefr01/WinC     ntfs-3g noauto,user,umask=000,relatime  0       0
\r\n# mount als user werkt niet zelfs met setfacl op ulefr01 van /media/ulefr01 !
\r\nUUID=C4BE2937BE292400                /media/ulefr01/WinC     ntfs-3g noauto,rw,exec,umask=000,relatime       0       0
\r\n# /dev/sdb4     /media/ulefr01/WinD     ntfs-3g noauto,user,umask=000,relatime  0       0
\r\nUUID=E6DCB388DCB35193                /media/ulefr01/WinD     ntfs-3g noauto,rw,exec,umask=000,relatime       0       0
\r\n# /dev/sdb5     /media/ulefr01/WinE     ntfs-3g noauto,user,umask=000,relatime  0       0
\r\nUUID=B204B41404B3D995                /media/ulefr01/WinE     ntfs-3g noauto,rw,exec,umask=000,relatime       0       0
\r\n# /dev/mapper/myssd-swap none            swap    sw              0       0
\r\n#
\r\nUUID=4D0E-9011                                  /stick16GB              vfat    noauto,user,noatime     0    0
\r\n#
\r\nUUID=349dd629-7fb7-41bc-9e5e-eef9f0f514a8       /stick32GB              ext4    noauto,user,noatime,exec   0    0
\r\nUUID=51FE-C5FC                                  /myssd2_EFI             vfat    noauto,user,noatime     0    0
\r\nUUID="a59547f3-adf3-4dae-9646-ba6ddd560ce4"    /myssd2_data2           ext4    noauto,user,noatime,data=writeback,commit=600,exec   0    0
\r\nUUID="90b9bdd6-2458-43a0-8000-de9bf96e4a38"    /myssd2_data        ext4    noauto,user,noatime,data=writeback,commit=600,exec   0   0
\r\nUUID=69D2-B18A                                  /myexthd1_EFI           vfat    noauto,user,noatime     0    0
\r\nUUID=db73a007-0730-4ef0-9ce2-1bba24039987       /myexthd1_2             ext4    noauto,user,noatime,exec   0    0
\r\nUUID=abc6cedf-ca7d-4748-ad7d-3a6f768cb0c5       /myexthd1_3             ext4    noauto,user,noatime,exec   0    0
\r\nUUID=9b3cc369-7d43-4d6f-8a87-936c404080bd       /myexthd1_4             ext4    noauto,user,noatime,exec   0    0
\r\nUUID="a491343c-6d60-4941-b4f4-9d5697bf6cfe"     /stick64GB              ext4    noauto,user,noatime    0    0
\r\n#

\r\n 

", "db_count": 140 }, { "taaknaam": "Fstab Dell Latitude E5440", "taaktext": "
\r\n# /etc/fstab: static file system information.\r\n#\r\n# Use 'blkid' to print the universally unique identifier for a\r\n# device; this may be used with UUID= as a more robust way to name devices\r\n# that works even if disks are added and removed. See fstab(5).\r\n#\r\n# systemd generates mount units based on this file, see systemd.mount(5).\r\n# Please run 'systemctl daemon-reload' after making changes here.\r\n#\r\n# <file system> <mount point>   <type>  <options>       <dump>  <pass>\r\n# /dev/mapper/myssd-root /               ext4    errors=remount-ro 0       1\r\nUUID=\"f352dc11-aea8-4833-838e-2560701deada\"\t/               ext4    errors=remount-ro 0       1\r\n# /boot was on /dev/sda1 during installation\r\nUUID=\"9ab7ebce-c8e2-4221-ba18-79e3ee11d70e\"\t/boot           ext4    defaults        0       2\r\n# /boot/efi was on /dev/sda2 during installation\r\nUUID=375C-2F09  /boot/efi       vfat    umask=0077      0       1\r\n# /dev/mapper/myssd-data /data           ext4    discard,noatime,nodiratime 0       2\r\nUUID=\"dfe8a1c3-f8c1-480c-ae75-524dffd4347d\"\t/data           ext4    discard,noatime,nodiratime 0       2\r\n# /dev/mapper/myssd-home /home           ext4    discard,noatime,nodiratime 0       2\r\nUUID=\"383ae642-5e8f-4482-874c-30c445a2b0f1\"\t/home           ext4    discard,noatime,nodiratime 0       2\r\n#\r\nUUID=\"cfa8f3e5-14cf-4c09-bf26-b39a6d7bafed\"     none    swap            sw      0       0\r\n# /dev/mapper/mydell-backup2  /backup2  ext4    noauto,user,noatime     0       2\r\nUUID=\"4d25461b-d635-47cb-bab2-b658bbbd7166\"  /backup3     ext4    noauto,user,noatime,exec 0      2\r\n/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0\r\n# binds\r\n/data\t\t/home/ulefr01/data\tnone bind\r\n#\r\n# /dev/sdb1 is oude /boot/efi\r\n# /dev/sdb3     /media/ulefr01/WinC     ntfs-3g noauto,user,umask=000,relatime  0       0\r\n# mount als user werkt niet zelfs met setfacl op ulefr01 van /media/ulefr01 !\r\nUUID=C4BE2937BE292400   /media/ulefr01/WinC     ntfs-3g noauto,rw,exec,umask=000,relatime       0       0\r\n# /dev/sdb4     /media/ulefr01/WinD     ntfs-3g noauto,user,umask=000,relatime  0       0\r\n# UUID=E6DCB388DCB35193   /media/ulefr01/WinD     ntfs-3g noauto,rw,exec,umask=000,relatime       0       0\r\n# /dev/sdb5     /media/ulefr01/WinE     ntfs-3g noauto,user,umask=000,relatime  0       0\r\n# UUID=B204B41404B3D995   /media/ulefr01/WinE     ntfs-3g noauto,rw,exec,umask=000,relatime       0       0\r\n# /dev/mapper/myssd-swap none            swap    sw              0       0\r\n# /dev/mapper/mydell-swap       none    swap    sw      0       0\r\n#UUID=f51d101d-bcc2-4406-b0e5-4bd8d14b0a5c none swap    sw      0       0\r\n#UUID=5d286c23-6404-48b5-b70e-46ca8f68bb06 none swap    sw      0       0\r\n\r\nUUID=4D0E-9011                                  /stick16GB              vfat    noauto,user,noatime     0\t0\r\n#\r\nUUID=349dd629-7fb7-41bc-9e5e-eef9f0f514a8       /stick32GB              ext4    noauto,user,noatime,exec   0\t0\r\n# UUID=51FE-C5FC                                  /myssd2_EFI             vfat    noauto,user,noatime     0  \t0\r\nUUID=a59547f3-adf3-4dae-9646-ba6ddd560ce4       /myssd2_data2           ext4    noauto,user,noatime,exec   0\t0\r\nUUID=\"90b9bdd6-2458-43a0-8000-de9bf96e4a38\" /myssd2_data  ext4 noauto,user,noatime,exec 0       2\r\n# UUID=02d537ed-d5f9-49b3-bbed-c372cb090078     /myssd2_data            ext4    noauto,user,noatime,exec   0\t0\r\n#UUID=\"312f8c97-bf2e-4b38-9bfa-6d62750f6cbc\"     /myssd2_boot            ext4    noauto,user,noatime,exec   0\t0\r\n#UUID=\"0cb30de6-e30c-4946-a3b4-59e094d0edd9\"     /myssd2_root            ext4    noauto,user,noatime,exec   0\t0\r\n#UUID=\"0f2ce667-4f37-48c8-9b93-4878677e8098\"     /myssd2_home            ext4    noauto,user,noatime,exec   0\t0\r\nUUID=69D2-B18A                                  /myexthd1_EFI           vfat    noauto,user,noatime     0  \t0\r\nUUID=db73a007-0730-4ef0-9ce2-1bba24039987       /myexthd1_2             ext4    noauto,user,noatime,exec   0\t0\r\nUUID=abc6cedf-ca7d-4748-ad7d-3a6f768cb0c5       /myexthd1_3             ext4    noauto,user,noatime,exec   0\t0\r\nUUID=9b3cc369-7d43-4d6f-8a87-936c404080bd       /myexthd1_4             ext4    noauto,user,noatime,exec   0\t0\r\nUUID=\"a491343c-6d60-4941-b4f4-9d5697bf6cfe\"     /stick64GB              ext4    noauto,user,noatime\t0\t0\r\n#\r\n
\r\n\r\n

 

", "db_count": 117 }, { "taaknaam": "Fstrim wanneer gedaan ?", "taaktext": "

Fstrim

\r\n\r\n

sudo journalctl | grep fstrim

\r\n\r\n

    toont wanneer fstrim gedaan wordt en wanneer niet 

\r\n\r\n

BIOS
\r\n    AHCI activeren  ipv IDE
\r\n    
\r\nswap partitie niet op SSD

\r\n\r\n

Fstab
\r\n    gebruik optie noatime

\r\n\r\n

Gebruik systemd en niet cron daily or cron weekly

\r\n\r\n

setup fstrim

\r\n\r\n
\r\n

sudo cp /usr/share/doc/util-linux/examples/fstrim.service [[/etc/systemd/system]]
\r\nsudo cp /usr/share/doc/util-linux/examples/fstrim.timer [[/etc/systemd/system]]

\r\n
\r\n\r\n


\r\n    adapt [[/etc/systemd/system/fstrim.timer]]
\r\n        change weekly into daily

\r\n\r\n
\r\n


\r\nsudo systemctl enable fstrim.timer

\r\n
\r\n\r\n

hoe zien fstim is uitgevoerd door server ?

\r\n\r\n
\r\n

sudo journalctl -u fstrim
\r\n    -- Logs begin at Wed 2018-05-02 16:10:49 CEST, end at Wed 2018-05-02 22:04:57 CE
\r\n    -- No entries --
\r\n    lines 1-2/2 (END)
\r\n    
\r\n    sudo journalctl -u fstrim
\r\n    -- Logs begin at Fri 2018-05-04 06:44:49 CEST, end at Fri 2018-05-04 08:51:05 CEST. --
\r\n    mei 04 06:44:52 ulefr01-inspiron systemd[1]: Starting Discard unused blocks...
\r\n    mei 04 06:44:56 ulefr01-inspiron fstrim[710]: /data: 49,5 GiB (53131530240 bytes) is getrimd
\r\n    mei 04 06:44:56 ulefr01-inspiron fstrim[710]: /home: 36,1 GiB (38776999936 bytes) is getrimd
\r\n    mei 04 06:44:56 ulefr01-inspiron fstrim[710]: /boot: 858,9 MiB (900624384 bytes) is getrimd
\r\n    mei 04 06:44:56 ulefr01-inspiron fstrim[710]: /: 36,8 GiB (39466745856 bytes) is getrimd
\r\n    mei 04 06:44:56 ulefr01-inspiron systemd[1]: Started Discard unused blocks.

\r\n
\r\n\r\n

fstrim manueel uitvoeren

\r\n\r\n
\r\n

    sudo fstrim -v /
\r\n    sudo fstrim -v /boot
\r\n    sudo fstrim -v /home
\r\n    sudo fstrim -v /data

\r\n 

\r\n
", "db_count": 119 }, { "taaknaam": "GPT disk", "taaktext": "

GPT

\r\n\r\n

UEFI systems :

\r\n\r\n

- EFI system met partition type = 'EF00'  partion vlaggen = 'boot,esp'

\r\n\r\n

- EFI op windows :

\r\n\r\n

    partitie type = '0700'  FAT32  partitie vlaggen = 'msftdata'

\r\n\r\n

Some newer systems use the GUID Partition Table (GPT) format. This was specified as part of the Extensible Firmware Interface (EFI), but it can also be used on BIOS platforms if system software supports it; for example, GRUB and GNU/Linux can be used in this configuration. With this format, it is possible to reserve a whole partition for GRUB, called the BIOS Boot Partition. GRUB can then be embedded into that partition without the risk of being overwritten by other software and without being contained in a filesystem which might move its blocks around.

\r\n\r\n

When creating a BIOS Boot Partition on a GPT system, you should make sure that it is at least 31 KiB in size. (GPT-formatted disks are not usually particularly small, so we recommend that you make it larger than the bare minimum, such as 1 MiB, to allow plenty of room for growth.) You must also make sure that it has the proper partition type. Using GNU Parted, you can set this using a command such as the following:

\r\n\r\n
\r\n# parted /dev/disk set partition-number bios_grub on    NIET gebruiken op UEFI systemen !\r\n
\r\n\r\n

If you are using gdisk, set the partition type to ‘0xEF02’. With partitioning programs that require setting the GUID directly, it should be ‘21686148-6449-6e6f-744e656564454649’.

\r\n\r\n

Caution: Be very careful which partition you select! When GRUB finds a BIOS Boot Partition during installation, it will automatically overwrite part of it. Make sure that the partition does not contain any other data.

\r\n\r\n

Note:

\r\n\r\n

Gparted /dev/disk  hangs wanneer GPT disk zonder een bios_grub partitie in legacy mode

\r\n\r\n

als grub-install correct uitgevoerd is zal de grub2 core.img plaatsen op de EF02 partitie

", "db_count": 128 }, { "taaknaam": "Gdisk tool", "taaktext": "

gdisk

\r\n\r\n

setup nieuwe disk met GPT UEFI

\r\n\r\n", "db_count": 129 }, { "taaknaam": "Gnome probleem", "taaktext": "

Gnome probleem

\r\n\r\n

probleem met gnome desktop :

\r\n\r\n\r\n\r\n

probleem met netwerk

\r\n\r\n\r\n\r\n

probleem met lightdm of gdm3

\r\n\r\n\r\n\r\n

probleem met apt , apt-get

\r\n\r\n", "db_count": 147 }, { "taaknaam": "Hoe een Logische Volume vergroten in LVM ?", "taaktext": "\r\n
\r\n

Hoe een Logische Volume vergroten ?

\r\n\r\n\r\n
", "db_count": 74 }, { "taaknaam": "Hoe een Logische Volume verkleinen in LVM ?", "taaktext": "\r\n
\r\n

Hoe een Logische Volume verkleinen ?

\r\n\r\n\r\n
\r\n\r\n

", "db_count": 75 }, { "taaknaam": "LVM", "taaktext": "

LVM = Logical Volume Manager

\r\n\r\n

With lvm, you can create/expand/shrink partitions on a running system, with out any down time..if you have more than one disk, Lvm can extend over more than one disk, so it is not limited by the size of one single disk, unlike your standard partitions. You can create snapshots and revert to the snapshot at a later time, or delete the snapshot if you no longer need it.

\r\n\r\n

Een partitie van het type = "Linux LVM" kan gebruikt worden voor logische volumen maar ook als "snapshot" !
\r\nEen snapshot kan een exact kopie zijn van een logische volume dat bevrozen is op een bepaald ogenblik : dit maakt het mogelijk om consistente backups te maken van logische volumen
\r\nterwijl de logische volumen in gebruik zijn !

\r\n\r\n

Installeer

\r\n\r\n\r\n\r\n

Creëer een fysisch volume

\r\n\r\n\r\n\r\n

Creëer een fysisch volume groep

\r\n\r\n\r\n\r\n

Voeg een logische volume toe in een volume groep

\r\n\r\n\r\n\r\n

Activeer een volume groep

\r\n\r\n\r\n\r\n

Mijn fysische en logische volumen

\r\n\r\n\r\n\r\n

Logische volume vergroten/verkleinen

\r\n\r\n\r\n\r\n

Toon fysische volume

\r\n\r\n\r\n\r\n

/dev/sda6 mydell lvm2 a-- 920,68g 500,63g

\r\n\r\n\r\n\r\n

 

\r\n\r\n

Toon volume groep

\r\n\r\n\r\n\r\n

 

\r\n\r\n

Toon logische volume(n)

\r\n\r\n\r\n\r\n

 

\r\n\r\n

 

\r\n\r\n

Doe logische volumes weg

\r\n\r\n\r\n\r\n

 

\r\n\r\n\r\n\r\n


\r\n 

\r\n\r\n

Doe een fysische volume weg van een volume groep

\r\n\r\n\r\n\r\n

 

\r\n\r\n

doe een volume groep weg van een fysische device

\r\n\r\n\r\n\r\n

 

\r\n\r\n

Problem with duplicate PVs LVS

\r\n\r\n\r\n\r\n

 

\r\n\r\n

 

", "db_count": 125 }, { "taaknaam": "Legacy naar UEFI", "taaktext": "

legacy naar uefi

\r\n\r\n

zie https://blog.getreu.net/projects/legacy-to-uefi-boot/

\r\n\r\n

1. Boot a live system

\r\n\r\n

Enable UEFI in bios.

\r\n\r\n

Boot an recent Debian live system on USB or DVD.

\r\n\r\n

2. Prepare the harddisk

\r\n\r\n

2.1. Backup your data

\r\n\r\n

Backup your data!

\r\n\r\n

2.2. Identify Debian’s “/boot” partition

\r\n\r\n

My lecagy boot system had a 243MiB ext2 partition mounted on /boot. This partition is never encrypted. It is where the grub files and Linux kernels reside. Check by double clicking on the partition icon on the live-disk-desktop and have a look inside.

\r\n\r\n
\r\n

# ls -l
\r\ntotal 21399
\r\n-rw-r--r-- 1 root root 155429 Sep 28 00:59 config-3.16-0.bpo.2-amd64
\r\ndrwxr-xr-x 3 root root 7168 Nov 5 08:03 grub
\r\n-rw-r--r-- 1 root root 15946275 Nov 5 16:28 initrd.img-3.16-0.bpo.2-amd64
\r\ndrwx------ 2 root root 12288 Nov 24 2012 lost+found
\r\n-rw-r--r-- 1 root root 2664392 Sep 28 00:59 System.map-3.16-0.bpo.2-amd64
\r\n-rw-r--r-- 1 root root 3126096 Sep 28 00:48 vmlinuz-3.16-0.bpo.2-amd64
\r\n# df -h
\r\nFilesystem Size Used Avail Use% Mounted on
\r\n...
\r\n/dev/sdb1 234M 28M 206M 13% /media/....

\r\nAs you can see in the following partition table of the Debian legacy boot system my /boot partition is number 1 (/dev/sdb1).

\r\n
\r\n\r\n

Although 1 is the default value for standard debian installations better check!
\r\nThe live system has identified this partition as /dev/sdb. The debian system on your harddisk could reference it differently.
\r\nPartition table of the Debian legacy boot system

\r\n\r\n
\r\n


\r\n# fdisk -l /dev/sdb
\r\n...
\r\nDevice Boot Start End Blocks Id System
\r\n/dev/sdb1 * 2048 499711 44032 7 HPFS/NTFS/exFAT
\r\n...
\r\n/dev/sdb5 501760 976771071 488134656 83 Linux

\r\n
\r\n\r\n


\r\nIn legacy boot mode the /boot partition must have the boot-flag (*) set. This confirms our assumption: the /boot filesystem is on: /dev/sdb1.

\r\n\r\n
\r\n

# gdisk -l /dev/sdb
\r\nGPT fdisk (gdisk) version 0.8.5

\r\n\r\n

Partition table scan:
\r\nMBR: MBR only
\r\nBSD: not present
\r\nAPM: not present
\r\nGPT: not present
\r\n...
\r\nNumber Start (sector) End (sector) Size Code Name
\r\n1 2048 499711 243.0 MiB 8300 Linux filesystem
\r\n5 501760 976771071 238.2 GiB 8300 Linux filesystem

\r\n
\r\n\r\n

2.3. Create GPT partition table

\r\n\r\n

Transform the partition table from MBR to GPT with

\r\n\r\n
\r\n

gdisk /dev/sdb

\r\n
\r\n\r\n

optie  r     recovery and transformation options (experts only)
\r\noptie  f     load MBR and build fresh GPT from it

\r\n\r\n

optie w    write table to disk and exit

\r\n\r\n

2.4. Create an UEFI partition

\r\n\r\n

A good graphical tool is the Gnome Partition Editor gparted:

\r\n\r\n
\r\n

# gparted /dev/sdb

\r\n
\r\n\r\n


\r\nShrink the /root partition to 200MB in order to free 43MB (see partition 1 below).

\r\n\r\n

Create a new 43MB partition for efi using gparted with partition code EF00 (EFI system) and flag it bootable. Format the partition with a fat32 [1] filesystem (see partition 2 below).

\r\n\r\n

UEFI needs additionally [2] a not formatted 1MB partition . [3] (see partition 3 below).

\r\n\r\n

Leave the other partitions untouched (see partition 5 below).

\r\n\r\n

Here the result:

\r\n\r\n

Partition table of the Debian UEFI boot system
\r\n 

\r\n\r\n
\r\n

# gdisk -l /dev/sdb
\r\nGPT fdisk (gdisk) version 0.8.5

\r\n\r\n

Partition table scan:
\r\nMBR: protective
\r\nBSD: not present
\r\nAPM: not present
\r\nGPT: present

\r\n\r\n

Found valid GPT with protective MBR; using GPT.
\r\nDisk /dev/sdb: 976773168 sectors, 465.8 GiB

\r\n\r\n

...

\r\n\r\n

Number Start (sector) End (sector) Size Code Name
\r\n1 2048 411647 200.0 MiB 8300 Linux filesystem
\r\n2 411648 499711 43.0 MiB EF00 Efi partition
\r\n3 499712 501759 1024.0 KiB 8300 Linux filesystem
\r\n5 501760 976771071 465.5 GiB 8300 Linux filesystem
\r\n[4]

\r\n
\r\n\r\n

3. Mount the Debian filesystem

\r\n\r\n

The next step differs whether the root-filesystem is encrypted or not.

\r\n\r\n

3.1. Mount a non-encrypted root-filesystem

\r\n\r\n

Mount the / (root) filesystem.

\r\n\r\n

For non-encrypted root filesystems a simple mount will do.

\r\n\r\n
\r\n

# mount -t ext4 /dev/sdb5 /mnt

\r\n
\r\n\r\n

3.2. Mount an encrypted root-filesystem

\r\n\r\n

For encrypted root filesystems the mounting procedure can be a little tricky especially when the root filesystem resides inside a logical volume which is encrypted. This section shows how to mount and unmount an encrypted root-filesystem.

\r\n\r\n

            The recovery mode of the Debian 9 Stretch installer disk automates all following steps. Try this first. If it does not work follow the rest of this section.
\r\n3.2.1. Find the device and partition of the to be mounted logical volume
\r\n            Connect the disk with host-system and observe the kernel messages in /var/log/syslog

\r\n\r\n
\r\n

root@host-system:~# tail  -f  /var/log/syslog
\r\nsd 3:0:0:0: [sdb] 976773168 512-byte logical blocks: (500 GB/465 GiB)
\r\nsd 3:0:0:0: [sdb] Write Protect is of manually.
\r\nsd 3:0:0:0: [sdb] Mode Sense: 43 00 00 00
\r\nsd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
\r\nsdb: sdb1 sdb2 sdb3 sdb5
\r\nsd 3:0:0:0: [sdb] Attached SCSI disk

\r\n
\r\n\r\n

The to be mounted device is /dev/sdb.

\r\n\r\n

Find the partition

\r\n\r\n
\r\n

root@host-system:~# gdisk -l /dev/sdb
\r\nGPT fdisk (gdisk) version 0.8.5
\r\n...
\r\nNumber Start (sector) End (sector) Size Code Name
\r\n1 2048 411647 200.0 MiB 8300 Linux filesystem
\r\n2 411648 494821 43.0 MiB 0700
\r\n3 494822 501759 1024.0 KiB 8300 Linux filesystem
\r\n5 501760 976771071 465.5 GiB 8300 Linux filesystem

\r\n
\r\n\r\n

The to be mounted logical volume of disk-system resides on /dev/sdb5.

\r\n\r\n

3.2.2. Mount encrypted logical volume
\r\n            Open decryption layer.

\r\n\r\n
\r\n

root@host-system:~# lvscan
\r\nACTIVE '/dev/host-system/root' [231.03 GiB] inherit
\r\nACTIVE '/dev/host-system/swap_1' [7.20 GiB] inherit
\r\nLogical volume is not registered yet. Do so.

\r\n\r\n

root@host-system:~# cryptsetup luksOpen /dev/sdb5 sdb5_crypt

\r\n
\r\n\r\n


\r\nEnter passphrase for /dev/sdb5:
\r\nEnter disk password.

\r\n\r\n
\r\n

root@host-system:~# lvscan
\r\ninactive '/dev/disk-system/root' [457.74 GiB] inherit
\r\ninactive '/dev/disk-system/swap_1' [7.78 GiB] inherit
\r\nACTIVE '/dev/host-system/root' [231.03 GiB] inherit
\r\nACTIVE '/dev/host-system/swap_1' [7.20 GiB] inherit
\r\nLogical volume of disk-system`is registered now. It contains one `root partition (line 1) and and one swap partition (line 2).

\r\n
\r\n\r\n

Activate logical volumes

\r\n\r\n
\r\n

root@host-system:~# lvchange -a y disk-system
\r\nCheck success.

\r\n
\r\n\r\n
\r\n

root@host-system:~# lvscan
\r\nACTIVE '/dev/disk-system/root' [457.74 GiB] inherit
\r\nACTIVE '/dev/disk-system/swap_1' [7.78 GiB] inherit
\r\nACTIVE '/dev/host-system/root' [231.03 GiB] inherit
\r\nACTIVE '/dev/host-system/swap_1' [7.20 GiB] inherit

\r\n
\r\n\r\n
\r\n

root@host-system:~# ls /dev/mapper
\r\ncontrol disksystem-root disksystem-swap_1 hostsystem-root hostsystem-swap_1 mymapper sdb5_crypt

\r\n
\r\n\r\n


\r\nMount logical volume

\r\n\r\n
\r\n

root@host-system:~# mount -t ext4 /dev/mapper/disksystem-root /mnt
\r\n 

\r\n
\r\n\r\n

Check success.

\r\n\r\n
\r\n

root@host-system:~# ls /mnt
\r\nbin etc initrd.img.old lib64 mnt proc sbin sys var
\r\nboot home lib lost+found mnt2 root selinux tmp vmlinuz
\r\ndev initrd.img lib32 media opt run srv usr vmlinuz.old

\r\n
\r\n\r\n

3.2.3. Unmount encrypted logical volume
\r\n           This subsection is only for completeness. Skip it.

\r\n\r\n
\r\n

root@host-system:~# umount /mnt

\r\n\r\n

root@host-system:~# lvscan
\r\nACTIVE '/dev/disk-system/root' [457.74 GiB] inherit
\r\nACTIVE '/dev/disk-system/swap_1' [7.78 GiB] inherit
\r\nACTIVE '/dev/host-system/root' [231.03 GiB] inherit
\r\nACTIVE '/dev/host-system/swap_1' [7.20 GiB] inherit

\r\n\r\n

root@host-system:~# lvchange -a n disk-system
\r\nroot@host-system:~# lvscan
\r\ninactive '/dev/disk-system/root' [457.74 GiB] inherit
\r\ninactive '/dev/disk-system/swap_1' [7.78 GiB] inherit
\r\nACTIVE '/dev/host-system/root' [231.03 GiB] inherit
\r\nACTIVE '/dev/host-system/swap_1' [7.20 GiB] inherit

\r\n\r\n

root@host-system:~# cryptsetup luksClose sdb5_crypt
\r\nroot@host-system:~# lvscan
\r\nACTIVE '/dev/host-system/root' [231.03 GiB] inherit
\r\nACTIVE '/dev/host-system/swap_1' [7.20 GiB] inherit

\r\n
\r\n\r\n

3.3. Mount the remaining filesystems

\r\n\r\n

        Either this way…​

\r\n\r\n
\r\n

# mount /dev/sdb1 /mnt/boot
\r\n# mount /dev/sdb2 /mnt/boot/efi

\r\n\r\n

# for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done
\r\n# chroot /mnt /bin/bash
\r\n
\r\nor this way, both commands do the same…​

\r\n\r\n

# mount /dev/sdb1 /mnt/boot
\r\n# mount /dev/sdb2 /mnt/boot/efi
\r\n# mount --bind /sys /mnt/sys
\r\n# mount --bind /proc /mnt/proc
\r\n# mount --bind /dev /mnt/dev
\r\n# mount --bind /dev/pts /mnt/dev/pts
\r\nInternet access
\r\nFor internet access inside chroot:

\r\n\r\n

    # cp /etc/resolv.conf /mnt/etc/resolv.conf

\r\n\r\n

probleem : efi variabelen are not supported  (modprobe efivars niet geladen of missing efivars in /sys/firmware/efi/efivars)

\r\n\r\n

    grub-install --force-extra-removable --target=x86_64-efi /dev/sda --recheck

\r\n
\r\n\r\n

4. Update debians /etc/fstab

\r\n\r\n

        Update the entries in /mnt/etc/fstab to reflect the partition changes above. Compare the UUID’s there with the ones listed here:

\r\n\r\n
\r\n

# ls /dev/disk/by-uuid
\r\n 

\r\n
\r\n\r\n

        Add the new UEFI partition (see last line in /etc/fstab below) in order to get it mounted permanently on /boot/efi.

\r\n\r\n
\r\n

# cat /mnt/etc/fstab
\r\n# <file system> <mount point> <type> <options> <dump> <pass>
\r\n/dev/mapper/koobue1-root / ext4 errors=remount-ro 0 1
\r\n# /boot was on /dev/sdb1 during installation
\r\nUUID=040cdd12-8e45-48bd-822e-7b73ef9fa09f /boot ext2 defaults 0 2
\r\n/dev/mapper/koobue1-swap_1 none swap sw 0 0
\r\n/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
\r\n#Jens: tmpfs added for SSD
\r\ntmpfs /tmp tmpfs defaults,nodev,nosuid,size=500m 0 0
\r\ntmpfs /var/lock tmpfs defaults,nodev,nosuid,noexec,mode=1777,size=100m 0 0
\r\ntmpfs /var/run tmpfs defaults,nodev,nosuid,noexec,mode=0775,size=100m 0 0
\r\nUUID=19F0-4372 /boot/efi vfat defaults 0 2

\r\n 

\r\n
\r\n\r\n

        I use /dev/mapper for the encrypted file system and tmpfs because I have an SSD disk.

\r\n\r\n

5. Inside the chroot environment

\r\n\r\n

        5.1. Preparation

\r\n\r\n

        Enter with:

\r\n\r\n
\r\n

# chroot /mnt
\r\n 

\r\n
\r\n\r\n

        Check

\r\n\r\n
\r\n

# cat /etc/fstab
\r\n 

\r\n
\r\n\r\n

        for not yet mounted entries and mount them manually e.g.

\r\n\r\n
\r\n

# mount /tmp
\r\n# mount /run
\r\n# mount /var/lock
\r\n...

\r\n
\r\n\r\n

5.2. Install grub-efi

\r\n\r\n
\r\n

# apt-get remove grub-pc
\r\n# apt-get install grub-efi
\r\n# grub-install /dev/sdb

\r\n 

\r\n
\r\n\r\n

        Check presence of the efi file:

\r\n\r\n
\r\n

# file /boot/efi/EFI/debian/grubx64.efi
\r\n/boot/efi/EFI/debian/grubx64.efi: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows

\r\n 

\r\n
\r\n\r\n

        A Debian entry should be listed here:

\r\n\r\n
\r\n

# efibootmgr
\r\nBootCurrent: 0000
\r\nTimeout: 0 seconds
\r\nBootOrder: 0000,2001,2002,2003
\r\nBoot0000* debian
\r\nBoot2001* EFI USB Device
\r\nBoot2002* EFI DVD/CDROM
\r\nBoot2003* EFI Network

\r\n 

\r\n
\r\n\r\n

        Exit chroot environment.

\r\n\r\n

                exit
\r\n        Reboot the system.

\r\n\r\n

 

", "db_count": 173 }, { "taaknaam": "Maken van backups met fsarchiver python programma myarchive myarchive_dir", "taaktext": "

start met Ventoy usb stick

\r\n\r\n

debian-live 10.9.0

\r\n\r\n

live Cd

\r\n\r\n\r\n\r\n

restore (restfs, restdir) wordt ook toegelaten met deze python programmas

", "db_count": 154 }, { "taaknaam": "MySSDs", "taaktext": "

Mydell Latitude E5440

\r\n\r\n

    SSD4    SK-Hynix           128 GB        koppelpunt

\r\n\r\n

                partitie 1                                                                                   /myssd4

\r\n\r\n

    SSD3    Samsung 860    1 TB

\r\n\r\n

                partitie 1                                                                                   /boot 

\r\n\r\n

                partitie 2    EFI Systeem

\r\n\r\n

                partitie 4     root                                                                        /

\r\n\r\n

                partitie 5                                                                                   /home

\r\n\r\n

                partitie 6                                                                                   /data

\r\n\r\n

                partitie 7    swap                                   

\r\n\r\n

                partitie 8    vg = myssd3    579,59 GB

\r\n\r\n

                                    lv = backup3    579 GB      

\r\n\r\n

 

\r\n\r\n

Mydell Inspiron 15

\r\n\r\n

    SSD1    Crucial MX500  500 GB

\r\n\r\n

                 partitie 3    vg = myssd

\r\n\r\n

                                    lvs = root, home, data

\r\n\r\n

    HDD         ST2000          2 TB

\r\n\r\n

                  partitie 6    vg = mydell

\r\n\r\n

                                    lvs = backup, backup2

\r\n\r\n

 

\r\n\r\n

Externe harde schijf SSD Crucial 

\r\n\r\n

    SSD2    Crucial MX500  1 TB

\r\n\r\n

                partitie 2                                465,3 GB                                    /myssd2_data

\r\n\r\n

                partitie 3                                465,3 GB                                    /myssd2_data2

\r\n\r\n

                                        

\r\n\r\n

Externe harde schijf SSD Netac

\r\n\r\n

    SSD5    Netac 1TB

\r\n\r\n

    

", "db_count": 140 }, { "taaknaam": "NetworkManager.conf", "taaktext": "

/etc/NetworkManager/NetworkManager.conf

\r\n\r\n

oorspronkelijk :

\r\n\r\n

 

\r\n\r\n
\r\n[main]\r\nplugins=ifupdown,keyfile\r\n \r\n[ifupdown]\r\nmanaged=false
\r\n\r\n

aanpassen naar :

\r\n\r\n

 

\r\n\r\n
\r\n[main]\r\nplugins=ifupdown,keyfile\r\n \r\n[ifupdown]\r\nmanaged=true
\r\n\r\n

tesamen met interfaces

\r\n\r\n

/etc/network/interfaces interfaces

\r\n\r\n

testen

\r\n\r\n

systemctl restart NetworkManager

\r\n\r\n

 

", "db_count": 110 }, { "taaknaam": "Opstarten bootable usb stick", "taaktext": "

Opstarten usb systemrescue  of met de Ventoy USB drive

\r\n\r\n\r\n\r\n

Opstarten usb debian

\r\n\r\n\r\n\r\n

​​​​​​​

\r\n\r\n

fsarchiver

\r\n\r\n\r\n\r\n

​​​​​​​​​​​​​​chroot

\r\n\r\n\r\n\r\n

 

", "db_count": 142 }, { "taaknaam": "Probleem pakket bij upgrade", "taaktext": "

voorbeeld : probleem met upgrade thunderbird door bug

\r\n\r\n

remove pakket

\r\n\r\n\r\n\r\n

installeer oudere versie

\r\n\r\n\r\n\r\n

zet pakket op hold zodat er geen upgrades meer plaatsvinden

\r\n\r\n\r\n\r\n

sudo apt-mark showhold

\r\n\r\n

sudo dpkg --get-selections
\r\n 

\r\n\r\n

probleem met starting thunderbird when launching an older version of thunderbird

\r\n\r\n\r\n\r\n

 

", "db_count": 133 }, { "taaknaam": "SQLITE3", "taaktext": "

 

\r\n\r\n

sqlite3

\r\n\r\n

Homepage SQLite3 zie : https://www.sqlite.org/index.html
\r\ndocumentatie zie : https://www.sqlite.org/docs.html

\r\n\r\n

versie 3.30.1

\r\n\r\n

Command Line shell for sqlite3  zie : https://www.sqlite.org/cli.html

\r\n\r\n

SQLite Tutorial zie : https://www.tutorialspoint.com/sqlite/index.htm

", "db_count": 126 }, { "taaknaam": "Sway Referentie Kaart", "taaktext": "

Sway Referentie Kaart

\r\n\r\n

basis

\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n
\r\n\t\t\t

alt + Enter

\r\n\t\t\t
\r\n\t\t\t

nieuwe terminal

\r\n\t\t\t
\r\n\t\t\t

alt + h / alt + ⬅

\r\n\t\t\t
\r\n\t\t\t

venster naar links

\r\n\t\t\t
\r\n\t\t\t

alt + j / alt + ⬇

\r\n\t\t\t
\r\n\t\t\t

venster naar beneden

\r\n\t\t\t
\r\n\t\t\t

alt + k / alt + ⬆ 

\r\n\t\t\t
\r\n\t\t\t

venster naar boven

\r\n\t\t\t
\r\n\t\t\t

alt + l / alt + ➡ 

\r\n\t\t\t
\r\n\t\t\t

venster naar rechts

\r\n\t\t\t
\r\n\t\t\t

alt + a 

\r\n\t\t\t
\r\n\t\t\t

venster met ouder

\r\n\t\t\t
\r\n\t\t\t

alt + space

\r\n\t\t\t
\r\n\t\t\t

focus verzetten

\r\n\t\t\t
\r\n\r\n

wijzig venster

\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n
\r\n\t\t\t

alt + f 

\r\n\t\t\t
\r\n\t\t\t

venster naar volledig scherm

\r\n\t\t\t
\r\n\t\t\t

alt + v

\r\n\t\t\t
\r\n\t\t\t

venster naar onder vertikaal (default)

\r\n\t\t\t
\r\n\t\t\t

alt + b

\r\n\t\t\t
\r\n\t\t\t

venster naar rechts horizontaal

\r\n\t\t\t
\r\n\t\t\t

alt + r 

\r\n\t\t\t
\r\n\t\t\t

vergroten/verkleinen venster ; Enter to stop

\r\n\t\t\t
\r\n\r\n

open applicatie

\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n
\r\n\t\t\t

alt + d

\r\n\t\t\t
\r\n\t\t\t

dmenu

\r\n\t\t\t
\r\n\t\t\t

 alt + ⬆ + q

\r\n\t\t\t
\r\n\t\t\t

sluit venster

\r\n\t\t\t
\r\n\r\n

wijzig container

\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n
\r\n\t\t\t

alt + x 

\r\n\t\t\t
\r\n\t\t\t

default

\r\n\t\t\t
\r\n\t\t\t

alt + s

\r\n\t\t\t
\r\n\t\t\t

stacking

\r\n\t\t\t
\r\n\t\t\t

alt + w

\r\n\t\t\t
\r\n\t\t\t

tabbed

\r\n\t\t\t
\r\n\r\n

beweeg venster

\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n
\r\n\t\t\t

alt + ⬆ + h / ⬅

\r\n\t\t\t
\r\n\t\t\t

beweeg venster naar links

\r\n\t\t\t
\r\n\t\t\t

alt + ⬆ + j / ⬇

\r\n\t\t\t
\r\n\t\t\t

beweeg venster naar onder

\r\n\t\t\t
\r\n\t\t\t

alt + ⬆ + k / ⬆

\r\n\t\t\t
\r\n\t\t\t

beweeg venster naar boven

\r\n\t\t\t
\r\n\t\t\t

alt + ⬆ + l / ➡

\r\n\t\t\t
\r\n\t\t\t

beweeg venster naar rechts

\r\n\t\t\t
\r\n\r\n

gebruik werkplaatsen

\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n
\r\n\t\t\t

alt + (0 – 9)

\r\n\t\t\t
\r\n\t\t\t

ga naar een ander werkplaats

\r\n\t\t\t
\r\n\t\t\t

alt + ⬆ + (0 – 9)

\r\n\t\t\t
\r\n\t\t\t

verplaats venster naar ander werkplaats

\r\n\t\t\t
\r\n\r\n

herstart

\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n
\r\n\t\t\t

alt + ⬆ + c

\r\n\t\t\t
\r\n\t\t\t

herlaad configuratie

\r\n\t\t\t
\r\n\t\t\t

alt + ⬆ + r

\r\n\t\t\t
\r\n\t\t\t

herstart sway

\r\n\t\t\t
\r\n\t\t\t

alt + ⬆ + e

\r\n\t\t\t
\r\n\t\t\t

ga uit sway, afmelden

\r\n\t\t\t
\r\n\r\n

applicaties

\r\n\r\n

    arandr     baobab    bluefish    chromium     discord        eid-viewer     

\r\n\r\n

    gnome-control-center     gnome-disks     gnome-system-monitor     gnome-tweaks

\r\n\r\n

    lxappearance     lxrandr     pavucontrol

\r\n\r\n

    system-config-printer     sxiv     thunar    thunderbird     totem     zim

\r\n\r\n

sway_swappy

\r\n\r\n

\"\"

\r\n\r\n

\"\"

\r\n\r\n

 

", "db_count": 115 }, { "taaknaam": "efibootmgr", "taaktext": "

Use Linux efibootmgr Command to Manage UEFI Boot Menu

\r\n\r\n

The Linux efibootmgr command line utility is very handy when it comes to managing UEFI boot menu. It’s assumed that you have installed Linux in UEFI mode.

\r\n\r\n

You can install the efibootmgr command line utility with the following commands.

\r\n\r\n

Debian/Ubuntu/Linux Mint

\r\n\r\n
\r\n
\r\nsudo apt install efibootmgr
\r\n
\r\n\r\n

Fedora, CentOS, RedHat

\r\n\r\n
\r\n
\r\nsudo dnf install efibootmgr
\r\n
\r\n\r\n

SuSE

\r\n\r\n
\r\n
\r\nsudo zypper install efibootmgr
\r\n
\r\n\r\n

Arch Linux/Manjaro

\r\n\r\n
\r\n
\r\nsudo pacman -S efibootmgr
\r\n
\r\n\r\n

1 Displaying Current Settings

\r\n\r\n

Simply run the following command. In some Linux distributions like Debian, you need to run it with sudo privilege.

\r\n\r\n
\r\n
\r\nefibootmgr
\r\n
\r\n\r\n

This command allows you to view the default boot entry (BootCurrent), boot order and all boot entries.  Each boot entry is identified by a boot number in hexadecimal. The asterisk (*) means the boot entry is active.+

\r\n\r\n

You can also add -v option to show verbose information.

\r\n\r\n
\r\n
\r\nefibootmgr -v
\r\n
\r\n\r\n

You can see the EFI system partition number, the partition table type (GPT), UUID of the EFI system partition and the boot loader file.

\r\n\r\n

2. Changing Boot Order

\r\n\r\n

First, copy the current boot order. For example, my boot order is:

\r\n\r\n
\r\n0013,0012,0014,0000,0001,0002,0003,000D,0011,0007,0008,0009,000A,000B,000C,000E
\r\n\r\n

Then type in the following command

\r\n\r\n
\r\n
\r\nsudo efibootmgr -o
\r\n
\r\n\r\n

And append the boot order to the above command.

\r\n\r\n
\r\n
\r\nsudo efibootmgr -o 0013,0012,0014,0000,0001,0002,0003,000D,0011,0007,0008,0009,000A,000B,000C,000E
\r\n
\r\n\r\n

Let’s say you want 0012 to be the first boot entry. All you have to do is move it to the left of 0013 and press Enter.

\r\n\r\n
\r\n
\r\nsudo efibootmgr -o 0012,0013,0014,0000,0001,0002,0003,000D,0011,0007,0008,0009,000A,000B,000C,000E
\r\n
\r\n\r\n

3. Adding Boot Entry

\r\n\r\n

If you have installed multiple Linux distributions on your computer, but one of the Linux distribution doesn’t have a UEFI boot entry, you can manually add it.

\r\n\r\n

Boot into the Linux distro that doesn’t have UFEI boot entry.  Then make sure it has the EFI version of GRUB boot loader installed.

\r\n\r\n

Debian/Ubuntu/Linux Mint

\r\n\r\n
\r\n
\r\nsudo apt install grub-efi
\r\n
\r\n\r\n

Fedora

\r\n\r\n
\r\n
\r\nsudo dnf install grub2-efi-modules
\r\n
\r\n\r\n

Then mount the EFI system partition (ESP) under /boot/efi/ directory. In this example, /dev/sda7 is the ESP.

\r\n\r\n
\r\n
\r\nsudo mount /dev/sda7 /boot/efi/
\r\n
\r\n\r\n

Then install Grub boot loader to ESP.

\r\n\r\n
\r\n
\r\nsudo grub-install /dev/sda --target=x86_64-efi --efi-directory=/boot/efi/
\r\n
\r\n\r\n

x86_64-efi means that we are going to install Grub for UEFI firmware. The default target is i386-pc, which is for traditional BIOS firmware.

\r\n\r\n

Now, you should see a new entry in UEFI boot menu with the bootmgr command.  Under the hood, the Grub installer first installs a .efi booloader file to /boot/efi/EFI/<label>/ directory. Usually it’s named grubx64.efi. Then it runs the following command to add a new entry in UEFI boot menu.

\r\n\r\n
\r\n
\r\nefibootmgr -c -d /dev/sda -p 7 -L <label> -l /EFI/<label>/grubx64.efi
\r\n
\r\n\r\n

Newly added entry will be the first in boot order.

\r\n\r\n

new entry for debian

\r\n\r\n
\r\n
\r\nefibootmgr --create --disk=/dev/sda --part=1 --label="debian" --loader='EFI/debian/shimx64.efi'
\r\n
\r\n\r\n

4. Deleting Boot Entry

\r\n\r\n

Let’s say you have installed multiple Linux distributions on a hard disk so you have multiple boot entries just like the above screenshot. And now you deleted a Linux distro but the boot entry is still there. To remove the respective boot entry, run:

\r\n\r\n
\r\n
\r\nsudo efibootmgr -b <bootnum> -B
\r\n
\r\n\r\n

For example,

\r\n\r\n
\r\n
\r\nsudo efibootmgr -b 0014 -B
\r\n
\r\n\r\n

-b option specify the boot number. -B option delete that boot number.

\r\n\r\n

5. Setting a Boot Entry Active or Inactive

\r\n\r\n

A boot entry followed by asterisk indicates that it’s active. Otherwise it’s inactive. To set a boot entry active, run:

\r\n\r\n
\r\n
\r\nsudo efibootmgr -b <bootnum> -a
\r\n
\r\n\r\n

To set a boot entry inactive, run:

\r\n\r\n
\r\n
\r\nsudo efibootmgr -b <bootnum> -A
\r\n
\r\n\r\n

 

", "db_count": 136 }, { "taaknaam": "herzet-interface-eth0-netwerk", "taaktext": "
\r\n#!/bin/bash\r\n# boot.log  krijgt : 'Failed to start Raise network interfaces\r\n#     check 'systemctl status networking.service'\r\n#     ifup failed to bring up eth0\r\n# reset netwerk na Raise Network failed message\r\n#\r\n# author franz ulenaers\r\n# email ulefr01@gmail.com\r\n# datum 20211011\r\n#\r\nSETUP=\"/etc/network/interfaces.d/setup\"\r\nSETUPBKUP=\"/$USER/setup.oud\"\r\nCONF=\"/etc/NetworkManager/NetworkManager.conf\"\r\nCONFBKUP=\"/$USER/NetworkManager.oud\"\r\nRES=1\r\n# only run as root\r\nif [ \"$(id -u)\" != '0' ]\r\nthen\r\n        echo \"Deze bash script \" $0 \" moet opgestart worden met root rechten (sudo \" $0 \" / su root) !\"\r\n        exit $RES\r\nfi\r\nRES=2\r\n# cp $SETUPBKUP $SETUP -v\r\n# cp $CONFBKUP $CONF -v\r\necho \"=============================================================================\"\r\necho -e \"===== \\t\\tstart \\t\\033[1m\\033[4m reset-netwerk \\033[0m \\t\\t\\t=====\"\r\necho -e \"===== \\tde volgende pakketten moeten geïnstalleerd worden \\t\\t=====\"\r\necho -e \"===== \\tvoor een goede werking van deze script \\t\\t\\t=====\"\r\necho -e \"===== \\thet zijn de pakketten inxi sed en mawk ! \\t\\t\\t=====\"\r\napt install inxi sed mawk\r\ninxi -ni | grep IF: | grep speed >ttt.netwerk\r\n# cat ttt.netwerk\r\nawk '{ print $2 }' <ttt.netwerk >ttt.netwerk2\r\n# cat ttt.netwerk2\r\nnetw=$(cat ttt.netwerk2)\r\necho \"=============================================================================\"\r\nif [ $netw == 'eth0' ]\r\nthen\r\n  echo -e \"===== \\tje lan interface is al eth0, er moet niks gedaan worden ! \\t\\t=====\"\r\n  exit $RES\r\nfi\r\necho -e \"===== \\tje lan interface is niet eth0 maar : $netw \\t\\t=====\"\r\n\r\ncp $SETUP $SETUPBKUP -v\r\necho -e  \"===== \\tje kopie van je oud bestand $SETUP is bewaard onder $SETUPBKUP  =====\"\r\ncp $CONF $CONFBKUP -v\r\necho -e \"===== \\tje kopie van je oud bestand $CONF is bewaard onder $CONFBKUP  =====\"\r\n\r\nmasker='s/eth0/'$netw'/1'\r\n# echo $masker\r\necho $masker >mask.sed\r\n\r\nsed  -f mask.sed $SETUP >nieuw.setup\r\n\r\ncat nieuw.setup >$SETUP\r\necho \"=============================================================================\"\r\necho -e \"===== \\tje bestand \\033[1m\\033[4m $SETUP \\033[0m is aangepast \\t=====\"\r\ncat $SETUP\r\necho \"=============================================================================\"\r\nsed 's/# managed=false/managed=true/1' $CONF >nieuw.conf\r\ngevonden=$(cat nieuw.conf | grep 'managed=true')\r\n# echo 'gevonden =' $gevonden\r\nif [ -z \"$gevonden\" ];\r\nthen\r\n  # echo 'gevonden is niks'\r\n  sed 's/managed=false/managed=true/1' $CONF >nieuw.conf\r\nfi\r\n# cat nieuw.conf\r\ngevonden=$(cat nieuw.conf | grep 'managed=true')\r\nif [ -z \"$gevonden\" ];\r\nthen\r\n  # echo 'gevonden(2) is niks'\r\n  gevonden=$(cat nieuw.conf | grep '[[ifupdown]]')\r\n  # echo 'gevonden3 is' $gevonden\r\n  if [ -z \"$gevonden\" ];\r\n  then\r\n    # echo 'gevonden(3) is niks'\r\n    echo '[ifupdown]' >>nieuw.conf\r\n    echo 'managed=true' >>nieuw.conf\r\n  else\r\n    if [ \"$gevonden\" = '[main]' ]\r\n    then\r\n      echo '[ifupdown]' >>nieuw.conf\r\n      echo 'managed=true' >>nieuw.conf\r\n    else\r\n      echo 'managed=true' >>nieuw.conf\r\n    fi\r\n  fi\r\nfi\r\ncat nieuw.conf >$CONF\r\necho -e \"===== je bestand \\033[1m\\033[4m\" $CONF \"\\033[0m is aangepast =====\"\r\ncat $CONF\r\necho \"=============================================================================\"\r\necho -e \"===== \\t\\t\\033[1m\\033[4m opkuis werkbestanden \\033[0m \\t\\t\\t\\t\\t=====\"\r\nrm nieuw.conf -v\r\nrm nieuw.setup -v\r\nrm ttt.netwerk -v\r\nrm ttt.netwerk2 -v\r\necho \"=============================================================================\"\r\necho -e '===== \\t\\t\\033[1m\\033[4mje netwerk wordt nu herstart\\033[0m \\t\\t\\t\\t====='\r\nsystemctl restart NetworkManager\r\nsystemctl restart networking\r\necho \"=============================================================================\"\r\necho -e \"===== Deze script $0 is \\033[1m\\033[4m correct \\033[0m uitgevoerd \\t=====\"\r\necho -e \"===== \\tje probleem moet nu opgelost zijn \\t\\t\\t\\t=====\"\r\necho -e \"===== \\tje kunt nu je computer \\033[1m\\033[4mrebooten\\033[0m \\t\\t\\t\\t=====\"\r\necho \"=============================================================================\"\r\necho -e \"===== \\tKuis  achteraf het bestand  $SETUPBKUP op ! \\t\\t=====\"\r\necho -e \"===== \\tKuis  achteraf het bestand $CONFBKUP op ! \\t=====\"\r\necho -e \"===== \\teinde script \" $0 \" \\t\\t\\t=====\"\r\necho \"=============================================================================\"\r\nRES=0\r\nexit $RES\r\n
\r\n\r\n

 

", "db_count": 105 }, { "taaknaam": "hp printer installatie", "taaktext": "
\r\nNodig :\r\n    naam wifi netwerk\r\n    wachtwoord wifi\r\n\r\nsudo apt install hplip hplip-gui hplip-data hplip-doc hpijs-ppds libsane-hpaio printer-driver-hpcups printer-driver-hpijs libhpmud0 ipp-usb libsane1 sane-airscan gscan2pdf\r\n\r\nals het knopje draadloos blauw licht en niet knippert dan is de printer verbonden in een netwerk\r\n\r\nreset printer\r\n    druk 3 seconden op knop Draadloos em knop Annuleren\r\n    het lampje draadloos moet blijven knipperen\r\n\r\nverbind printer met usb kabel aan computer\r\n\r\nip route\r\n\r\nip route | grep kernel\r\n    kijk naar het ip adres 0/24\r\n\r\nnmap -v het_vorig_ip_adres 0/24\r\n(mijne was : nmap -v 192.168.223.0/24 )\r\n\r\nprinter web interface \r\n    browser : localhost:60000\r\n        settings\r\n            admin\r\n            12345678\r\n        network\r\n            wireless\r\n                setup wizard\r\n                    select wifi netwerk\r\n                    vul in wifi wachtwoord\r\n                    dhcp\r\n    \r\n        nmap -v 192.168.223.0/24 | grep deskjet\r\n        haal ip address op\r\n\r\n    browser : //het_ip_adres\r\n        settings\r\n            admin\r\n            12345678\r\n        network\r\n            wireless\r\n            ipv4\r\n                manual ipv4\r\n                    manual ip address\r\n                    manual subnet address\r\n                    manual default gateway\r\n                automatic DNS\r\n            APPLY\r\n\r\ncd ~/.hplip\r\nhp-setup\r\nhp-setup -i ipaddress \r\n\r\nmaak printer los van usb kabel\r\n\r\nhp-doctor\r\n\r\nhp-toolbox\r\n    Actions\r\n        print\r\n        scan\r\n        print test page\r\n        View Printer and Device Information\r\n        align cartridges\r\n        clean printhesda\r\n        open printers web page in browser\r\n        visit hplip support\r\n        help\r\n    Status\r\n        out of paper\r\n        chronologische volorde van wat printer gedaan heeft        \r\n    Supplies\r\n        kleur cartridge : level status\r\n        zwart cartridge . level  status\r\n    Print Settings\r\n    Printer Control\r\n    Preferences\r\n        auto refresh\r\n        system tray icon\r\n    \r\nscanimage -L\r\n    device `hpaio:/net/DeskJet_3630_series?ip=192.168.223.3' is a Hewlett-Packard     DeskJet_3630_series all-in-one\r\n\r\nkillall hp-systray\r\n\r\nhp-toolbox\r\n    refresh\r\n    status\r\n\r\nscanner\r\n    scan\r\n    xsane \r\n    gscan2pdf\r\n
\r\n\r\n

 

\r\n\r\n

                

", "db_count": 138 }, { "taaknaam": "installeer systemd-boot loader op debian met bootctl", "taaktext": "
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n

systemd-boot.md

\r\n
\r\n
\r\n\r\n
\r\n
\r\n

titel: "systemd-boot met bootctl"

\r\n\r\n

beschrijving: "bootloader van systemd"

\r\n\r\n

screenshot: https://en.wikipedia.org/wiki/Systemd-boot#/media/File:Arch_Linux_UEFI_loader_screenshot.png

\r\n\r\n

categoriën:

\r\n\r\n
    \r\n\t
  • systemd
  • \r\n\t
  • bootloader
  • \r\n\t
  • boot
  • \r\n\t
  • UEFI
  • \r\n\t
  • bootctl
  • \r\n\t
  • klonen
  • \r\n\t
  • systemd-boot-update
  • \r\n
\r\n\r\n
\r\n

Installeer systemd-boot loader op debian

\r\n\r\n

Vereisten

\r\n\r\n
    \r\n\t
  • BIOS instellen in UEFI mode (geen legacy)
  • \r\n\t
  • je schijf moet ingedeeld zijn in GPT (geen MBR) !
  • \r\n\t
  • een UEFI partitie moet aangemaakt zijn
  • \r\n
\r\n\r\n

Installeer bootloader

\r\n\r\n

Check je bootorder met het efibootmgr commando

\r\n\r\n
\r\n
\r\n        # uitvoeren van commando efibootmgr \r\n        efibootmgr
\r\n
\r\n\r\n

De BootCurrent order zal normaal als eerste boot om je huidig systeem op te starten op een nummer staan zoals 000n met Boot000n verwijzend naar Debian .

\r\n\r\n

Om de bootloader te installeren moet het pakket systemd-boot geïnstalleerd zijn !

\r\n\r\n

Installeer bootloader met het bootctl commando (let op : root rechten zijn vereist!)

\r\n\r\n
\r\n
\r\n        # installeer bootctl\r\n        # sudo apt install systemd-boot\r\n        bootctl install --esp-path=/boot/efi
\r\n
\r\n\r\n

Als de installatie van bootctl succesvol is moet je efibootmgr nu verwijzen naar Linux Boot Manager als je eerste boot en debian als je tweede boot selectie.

\r\n\r\n

Creëer een /etc/kernel/postinst.d/zz-update-systemd-boot bestand

\r\n\r\n

Creëer het bestand zz-update-system-boot binnen de map /etc/kernel/postinst.d/ (root rechten vereist !)

\r\n\r\n
\r\n
\r\n        #!/bin/sh\r\n        set -e\r\n        /usr/bin/kernel-install -v add "$1" "$2"\r\n        exit 0  
\r\n
\r\n\r\n

Deze procedure creëert kernel en initramfs images met de kernel-install tool van het systemd pakket (voor meer: man kernel-install)

\r\n\r\n
\r\n

Noot : de -v in /usr/bin/kernel-install -v add mag eruit

\r\n
\r\n\r\n
\r\n
\r\n   met -v optie wordt  de werking getoond  in /var/log/apt/term.log !\r\n
\r\n
\r\n\r\n

Maak het bestand /etc/kernel/postinst.d/zz-update-systemd-boot bestand uitvoerbaar

\r\n\r\n
\r\n
\r\n        # maak het bestand uitvoerbaar \r\n        chmod a+x /etc/kernel/postinst.d/zz-update-systemd-boot
\r\n
\r\n\r\n

Creëer een /etc/kernel/postrm.d/zz-update-systemd-boot bestand

\r\n\r\n

Creëer het bestand zz-update-system-boot binnen de map /etc/kernel/postrm.d/ (root rechten vereist !)

\r\n\r\n
\r\n
\r\n        #!/bin/sh\r\n        set -e\r\n        /usr/bin/kernel-install -v remove "$1"\r\n        exit 0  
\r\n
\r\n\r\n

Maak het bestand /etc/kernel/postrm.d/zz-update-systemd-boot bestand uitvoerbaar

\r\n\r\n
\r\n
\r\n        # maak het bestand uitvoerbaar\r\n        chmod a+x /etc/kernel/postrm.d/zz-update-systemd-boot
\r\n
\r\n\r\n

Creëer configuratie bestand /boot/efi/loader/loader.conf

\r\n\r\n

/boot/efi/loader/loader.conf

\r\n\r\n
\r\n
\r\n        # als voorbeeld\r\n        default debian\r\n        timeout 3   \r\n        editor 1
\r\n
\r\n\r\n

Creëer de map /boot/efi/je_machine_id/

\r\n\r\n

Voer uit :

\r\n\r\n
\r\n
\r\n        # voer uit om te zien wat je machine-id is op je systeem\r\n        cat /etc/machine-id
\r\n
\r\n\r\n

uitvoer is een hexadecimaal getal van 32 karakters en ziet eruit als volgt:

\r\n\r\n

(dit als voorbeeld !)

\r\n\r\n
\r\n
\r\n        # als voorbeeld\r\n        2af230c8d6464a7d8e64657bf5584ee3
\r\n
\r\n\r\n

Creëer de map /boot/efi/je-machine-id met het mkdir commando

\r\n\r\n
\r\n
\r\n        # met als <je-machine-id> bovenstaand hexadecimaal getal van 32 karakters\r\n        mkdir /boot/efi/2af230c8d6464a7d8e64657bf5584ee3
\r\n
\r\n\r\n

Voer het commando kernel-install uit als volgt

\r\n\r\n

Doe een 'kernel-install add' van je kernel versie

\r\n\r\n
\r\n
\r\n        # dit is de kernel-install voor versie 5.10.0-15-amd64\r\n        kernel-install -v add 5.10.0-15-amd64 initrd.img-5.10.0-15-amd64 vmlinuz-5.10.0-15-amd64 \r\n        #
\r\n
\r\n\r\n

Doe hetzelfde voor al je andere kernel versies (zoals hierboven)

\r\n\r\n

indien bovenstaand 'kernel-install add' faalt , doe dan eerst een 'kernel-install remove' vooraleer de 'kernel-install add' opnieuw te doen , dit als volgt

\r\n\r\n
\r\n
\r\n        # dit is de kernel-install voor versie 5.10.0-15-amd64\r\n        kernel-install remove  5.10.0-15-amd64  
\r\n
\r\n\r\n

Check je map /boot/efi/loader/

\r\n\r\n

De map /boot/efi/loader/ bevat de bestanden :

\r\n\r\n
    \r\n\t
  • loader.conf
  • \r\n\t
  • random-seed
  • \r\n
\r\n\r\n

De map /boot/efi/loader/ bevat een map :

\r\n\r\n
    \r\n\t
  • entries
  • \r\n
\r\n\r\n

deze map entries bevat al de configuratiebestanden voor al je kernel versies

\r\n\r\n

als voorbeeld:

\r\n\r\n
    \r\n\t
  • 2af230c8d6464a7d8e64657bf5584ee3-5.10.0-14-amd64.conf
  • \r\n\t
  • 2af230c8d6464a7d8e64657bf5584ee3-5.10.0-15-amd64.conf
  • \r\n\t
  • 2af230c8d6464a7d8e64657bf5584ee3-5.10.0-8-amd64.conf
  • \r\n
\r\n\r\n

Reboot je operating systeem

\r\n\r\n
\r\n
\r\n        # reboot\r\n        reboot
\r\n
\r\n\r\n

Je bent nu klaar

\r\n\r\n

Systemd-boot bootmenu

\r\n\r\n
\r\n
\r\n        h,7,F1          help\r\n        e               edit\r\n        d               make entry default      \r\n        +,t             increase timeout\r\n        -,T             decrease timeout \r\n        f               reboot\r\n        Esc\r\n        ctrl+k          clear command line in edit mode\r\n        1,2,3,4,...     entry member\r\n        l               linux\r\n        w               windows
\r\n
\r\n\r\n

Check/verifiëer je bootctl installatie

\r\n\r\n

bootctl is een procedure meegeleverd met het systemd pakket

\r\n\r\n
    \r\n\t
  • doe de bootctl met optie status
  • \r\n
\r\n\r\n
\r\n
\r\n        # bootctl status\r\n        bootctl status
\r\n
\r\n\r\n
    \r\n\t
  • uitvoer van 'bootctl status' ziet er zo uit (als voorbeeld):
  • \r\n
\r\n\r\n
\r\n
\r\n       System:\r\n     Firmware: UEFI 2.40 (American Megatrends 5.11)\r\n  Secure Boot: disabled\r\n   Setup Mode: user\r\n Boot into FW: supported\r\n\r\nCurrent Boot Loader:\r\n      Product: systemd-boot 247.3-6\r\n     Features: ✓ Boot counting\r\n               ✓ Menu timeout control\r\n               ✓ One-shot menu timeout control\r\n               ✓ Default entry control\r\n               ✓ One-shot entry control\r\n               ✓ Support for XBOOTLDR partition\r\n               ✓ Support for passing random seed to OS\r\n               ✓ Boot loader sets ESP partition information\r\n          ESP: /dev/disk/by-partuuid/21d6d264-bbac-4c1a-b628-2e97a21c5182\r\n         File: └─/EFI/systemd/systemd-bootx64.efi\r\n\r\nRandom Seed:\r\n Passed to OS: yes\r\n System Token: set\r\n       Exists: yes\r\n\r\nAvailable Boot Loaders on ESP:\r\n          ESP: /boot/efi (/dev/disk/by-partuuid/21d6d264-bbac-4c1a-b628-2e97a21>\r\n         File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot 247.3-6)\r\n         File: └─/EFI/BOOT/BOOTX64.EFI (systemd-boot 247.3-6)\r\n\r\nBoot Loaders Listed in EFI Variables:\r\n        Title: Linux Boot Manager\r\n           ID: 0x0007\r\n       Status: active, boot-order\r\n    Partition: /dev/disk/by-partuuid/21d6d264-bbac-4c1a-b628-2e97a21c5182\r\n         File: └─/EFI/systemd/systemd-bootx64.efi\r\n\r\n        Title: debian\r\n           ID: 0x0002\r\n       Status: active, boot-order\r\n    Partition: /dev/disk/by-partuuid/21d6d264-bbac-4c1a-b628-2e97a21c5182\r\n         File: └─/EFI/debian/shimx64.efi\r\n\r\n        Title: usb\r\n           ID: 0x0004\r\n       Status: active, boot-order\r\n    Partition: /dev/disk/by-partuuid/bf5282d8-e895-439e-8595-d4580486b17f\r\n         File: └─/EFI/Boot/bootx64.efi\r\n\r\n        Title: test\r\n           ID: 0x0001\r\n       Status: active, boot-order\r\n    Partition: /dev/disk/by-partuuid/1cb0011a-3c55-4a8c-9437-11c6254f6f3e\r\n         File: └─/EFI/debian/shimx64.efi\r\n\r\n        Title: UEFI: ST2000LM003 HN-M201RAD, Partition 1\r\n           ID: 0x0016\r\n       Status: active, boot-order\r\n    Partition: /dev/disk/by-partuuid/6b44c434-5196-49d8-b29a-31de8a4bbe34\r\n         File: └─EFI/Microsoft/Boot/bootmgfw.efi\r\n\r\n        Title: Windows Boot Manager\r\n           ID: 0x0000\r\n       Status: active, boot-order\r\n    Partition: /dev/disk/by-partuuid/21d6d264-bbac-4c1a-b628-2e97a21c5182\r\n         File: └─/EFI/Microsoft/Boot/bootmgfw.efi\r\n\r\n        Title: UEFI: CT500MX500SSD1, Partition 1\r\n           ID: 0x0017\r\n       Status: active, boot-order\r\n    Partition: /dev/disk/by-partuuid/21d6d264-bbac-4c1a-b628-2e97a21c5182\r\n         File: └─EFI/Microsoft/Boot/bootmgfw.efi\r\n\r\n        Title: debian2\r\n           ID: 0x0006\r\n       Status: active\r\n    Partition: /dev/disk/by-partuuid/bf5282d8-e895-439e-8595-d4580486b17f\r\n         File: └─/EFI/debian/shimx64.efi\r\n\r\n        Title: UEFI: ST2000LM003 HN-M201RAD, Partition 1\r\n           ID: 0x000A\r\n       Status: active\r\n    Partition: /dev/disk/by-partuuid/6b44c434-5196-49d8-b29a-31de8a4bbe34\r\n         File: └─EFI/Microsoft/Boot/bootmgfw.efi\r\n\r\nBoot Loader Entries:\r\n        $BOOT: /boot/efi (/dev/disk/by-partuuid/21d6d264-bbac-4c1a-b628-2e97a21>\r\n\r\nDefault Boot Loader Entry:\r\n        title: Debian GNU/Linux 11 (bullseye) (5.10.0-15-amd64)\r\n           id: 2af230c8d6464a7d8e64657bf5584ee3-5.10.0-15-amd64.conf\r\n       source: /boot/efi/loader/entries/2af230c8d6464a7d8e64657bf5584ee3-5.10.0>\r\n      version: 5.10.0-15-amd64\r\n   machine-id: 2af230c8d6464a7d8e64657bf5584ee3\r\n        linux: /2af230c8d6464a7d8e64657bf5584ee3/5.10.0-15-amd64/linux\r\n       initrd: /2af230c8d6464a7d8e64657bf5584ee3/5.10.0-15-amd64/initrd.img-5.1>\r\n      options: root=UUID=0d8f82d3-9635-4e9c-8f6e-1512f4e1b2d6 ro quiet\r\n
\r\n
\r\n\r\n
    \r\n\t
  • Doe de bootctl met optie list
  • \r\n
\r\n\r\n
\r\n
\r\n        # bootctl list\r\n        bootctl list
\r\n
\r\n\r\n
    \r\n\t
  • uitvoer van 'bootctl list' ziet er zo uit (dit als voorbeedl):
  • \r\n
\r\n\r\n
\r\n
\r\n        Boot Loader Entries:\r\n        title: Debian GNU/Linux 11 (bullseye) (5.10.0-8-amd64)\r\n           id: 2af230c8d6464a7d8e64657bf5584ee3-5.10.0-8-amd64.conf\r\n       source: /boot/efi/loader/entries/2af230c8d6464a7d8e64657bf5584ee3-5.10.0-8-amd64.conf\r\n      version: 5.10.0-8-amd64\r\n   machine-id: 2af230c8d6464a7d8e64657bf5584ee3\r\n        linux: /2af230c8d6464a7d8e64657bf5584ee3/5.10.0-8-amd64/linux\r\n       initrd: /2af230c8d6464a7d8e64657bf5584ee3/5.10.0-8-amd64/initrd.img-5.10.0-8-amd64\r\n      options: root=UUID=0d8f82d3-9635-4e9c-8f6e-1512f4e1b2d6 ro quiet\r\n\r\n        title: Debian GNU/Linux 11 (bullseye) (5.10.0-14-amd64)\r\n           id: 2af230c8d6464a7d8e64657bf5584ee3-5.10.0-14-amd64.conf\r\n       source: /boot/efi/loader/entries/2af230c8d6464a7d8e64657bf5584ee3-5.10.0-14-amd64.conf\r\n      version: 5.10.0-14-amd64\r\n   machine-id: 2af230c8d6464a7d8e64657bf5584ee3\r\n        linux: /2af230c8d6464a7d8e64657bf5584ee3/5.10.0-14-amd64/linux\r\n       initrd: /2af230c8d6464a7d8e64657bf5584ee3/5.10.0-14-amd64/initrd.img-5.10.0-14-amd64\r\n      options: root=UUID=0d8f82d3-9635-4e9c-8f6e-1512f4e1b2d6 ro quiet\r\n\r\n        title: Debian GNU/Linux 11 (bullseye) (5.10.0-15-amd64) (default)\r\n           id: 2af230c8d6464a7d8e64657bf5584ee3-5.10.0-15-amd64.conf\r\n       source: /boot/efi/loader/entries/2af230c8d6464a7d8e64657bf5584ee3-5.10.0-15-amd64.conf\r\n      version: 5.10.0-15-amd64\r\n   machine-id: 2af230c8d6464a7d8e64657bf5584ee3\r\n        linux: /2af230c8d6464a7d8e64657bf5584ee3/5.10.0-15-amd64/linux\r\n       initrd: /2af230c8d6464a7d8e64657bf5584ee3/5.10.0-15-amd64/initrd.img-5.10.0-15-amd64\r\n      options: root=UUID=0d8f82d3-9635-4e9c-8f6e-1512f4e1b2d6 ro quiet\r\n\r\n        title: Windows Boot Manager\r\n           id: auto-windows\r\n       source: /sys/firmware/efi/efivars/LoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f\r\n\r\n        title: Reboot Into Firmware Interface\r\n           id: auto-reboot-to-firmware-setup\r\n       source: /sys/firmware/efi/efivars/LoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f\r\n
\r\n
\r\n\r\n

Een nieuwe versie van bootctl installeren

\r\n\r\n

gebruik hiervoor het bootctl commando met optie update

\r\n\r\n
\r\n
\r\n        # bootctl update\r\n        bootctl update
\r\n
\r\n\r\n

Opzetten van een service update bootctl

\r\n\r\n
\r\n
\r\n        sudo systemctl enable systemd-boot-update # éénmalig !\r\n        sudo systemctl start systemd-boot-update  # éénmalig !\r\n        # check status\r\n        sudo systemctl status systemd-boot-update
\r\n
\r\n\r\n

Verander de default waarde met bootctl

\r\n\r\n

Het is mogelijk de EFI variabele LoaderEntryDefault (in /sys/firmware/efi/efivars/) te wijzigen

\r\n\r\n

De mogelijke waarden kun je vinden in /boot/efi/loader/entries

\r\n\r\n
\r\n
\r\n        # mogelijke waarden kun je vinden\r\n        ls /boot/efi/loader/entries/ 
\r\n
\r\n\r\n

output (dit als voorbeeld !)

\r\n\r\n
\r\n
\r\n        2af230c8d6464a7d8e64657bf5584ee3-5.10.0-8-amd64.conf\r\n        2af230c8d6464a7d8e64657bf5584ee3-5.10.0-14-amd64.conf\r\n        2af230c8d6464a7d8e64657bf5584ee3-5.10.0-15-amd64.conf
\r\n
\r\n\r\n

verander bijvoorbeeld de default waarde naar 2af230c8d6464a7d8e64657bf5584ee3-5.10.0-14-amd64.conf Hiervoor gebruik je het bootctlcommando met de set-default optie

\r\n\r\n
\r\n
\r\n        # bootctl set-default ...\r\n        bootctl set-default 2af230c8d6464a7d8e64657bf5584ee3-5.10.0-14-amd64.conf
\r\n
\r\n\r\n

Bootloader bij het klonen van computers

\r\n\r\n

Vereist nieuw machine-id

\r\n\r\n
\r\n
\r\n        rm /etc/machine-id\r\n        systemd-machine-id-setup
\r\n
\r\n\r\n

entries aanpassen in /boot/efi/loader/entries map /boot/efi/'nieuw_machine_id'

\r\n\r\n

Vereist nieuw UUID's voor ieder partitie en/of logische volume

\r\n\r\n
\r\n
\r\n        tune2fs -U nieuw_uuid /dev/mapper/ ...\r\n        # vereist eerst een : e2fsck -f /dev/mapper/....
\r\n
\r\n\r\n

ofwel met : 'gparted /dev/sda' en selecteer partitie nieuw UUID

\r\n\r\n

Update-initramfs vereist

\r\n\r\n
\r\n
\r\n        update-initramfs -u
\r\n
\r\n\r\n

Creëer indien nodig een nieuwe entry in efibootmgr

\r\n\r\n
\r\n
\r\n        efibootmgr --create --disk=/dev/sda --part=1 --label='debian' --loader='EFI/debian/shimx64.efi' \r\n
\r\n
\r\n\r\n

Indien je toch deze installatie wil teniet doen

\r\n\r\n

Hiervoor gebruik je het bootctl commando met de remove optie

\r\n\r\n
\r\n
\r\n        # indien je toch de installatie wil teniet doen\r\n        bootctl remove\r\n        exit
\r\n
\r\n\r\n
\r\n

Maak dat je kunt opstarten met een andere bootloader (Grub, Refind, Lilo, ...) vooraleer je computer te herstarten.

\r\n
\r\n\r\n

Problemen bij het heropstarten van je computer

\r\n\r\n

Gebruik de recenste systemrescuecd en start de systemrescue iso het best op in copy to RAM mode copytoram

\r\n\r\n
\r\n
\r\n        cd /mnt\r\n        mkdir root\r\n        # /mnt/root wordt dan de basis map voor de chroot\r\n        # mount je root partitie\r\n        ...\r\n        # mount je boot, boot/efi, home en data partities (indien van toepassing) onder de basis map\r\n        ...\r\n        # mount efivars, dev, proc, sys, run \r\n        for i in proc sys run dev dev/pts sys/firmware/efi/efivars do mount -o bind /$i /mnt/root/$i; done\r\n        chroot /mnt/root\r\n        # doe updates binnen chroot\r\n        ....\r\n        # exit chroot\r\n        exit \r\n        #\r\n        for i in sys/firmware/efi/efivars dev/pts dev sys proc run; do umount /mnt/root/$i; done\r\n        #\r\n        umount /mnt/root/boot/efi \r\n        umount /mnt/root/boot\r\n        umount /mnt/root/home \r\n        umount /mnt/root/data \r\n        ...\r\n        umount /mnt/root\r\n        ...\r\n        reboot
\r\n
\r\n\r\n

Ofwel opstarten in Grub (ook al start je systeem niet meer automatisch op in Grub !) dit als je grub nog niet weggegooid hebt van je systeem ! Boot in UEFI mode vanaf Super Grub2 Disk

\r\n\r\n
    \r\n\t
  • \r\n\t

    Zet RAID mode en LVM mode aan

    \r\n\t
  • \r\n\t
  • \r\n\t

    Selecteer Manueel Grub2 proces

    \r\n\t
  • \r\n\t
  • \r\n\t

    Laat Grub2 disk zoeken naar je Grub2 Configfiles

    \r\n\t
  • \r\n\t
  • \r\n\t

    selecteer nog een goeie Configfile en start op

    \r\n\t
  • \r\n\t
  • \r\n\t

    Bij foute Configfile selectie , doe Esc en neem een andere Configfile.

    \r\n\t
  • \r\n
\r\n\r\n

confer de oorspronkelijk website : link naam

\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
", "db_count": 231 }, { "taaknaam": "interfaces", "taaktext": "

/etc/network/interfaces

\r\n\r\n

oorspronkelijk :

\r\n\r\n
\r\n# This file describes the network interfaces available on your system\r\n# and how to activate them. For more information, see interfaces(5).\r\n\r\nsource /etc/network/interfaces.d/*\r\n\r\n# The loopback network interface\r\nauto lo\r\niface lo inet loopback
\r\n\r\n

aanpassen

\r\n\r\n

lijn source /etc/network/interfaces.d/*   in commentaar zodat setup niet aangeroepen wordt !

\r\n\r\n

bekijk ethernet driver eth0  (ifconfig)

\r\n\r\n

neem statisch ip adres ipv dynamisch

\r\n\r\n

gebruik Wake On Lan 

\r\n\r\n

    apt install wakeonlan, etherwake

\r\n\r\n

ethtool enp3s0 

\r\n\r\n

    moet op Wake-on moet op g staan ipv d !

\r\n\r\n

ethtool -s enp3s0 wol g

\r\n\r\n

aanpassen naar :

\r\n\r\n
\r\n# This file describes the network interfaces available on your system\r\n# and how to activate them. For more information, see interfaces(5).\r\n\r\n# source /etc/network/interfaces.d/*\r\n\r\n# The loopback network interface\r\nauto lo\r\niface lo inet loopback\r\n\r\n
\r\n\r\n

 

", "db_count": 104 }, { "taaknaam": "mijn lokaal netwerk", "taaktext": "

smartphone gebruik Netwerk Scanner  / Net Scan

\r\n\r\n\r\n\r\n

 

\r\n\r\n

 

", "db_count": 90 }, { "taaknaam": "mount probleem", "taaktext": "

sudo dmesg toont : 

\r\n\r\n

ar  7 23:26:17 ulefr01-inspiron kernel: [21364.039142] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
\r\nMar  7 23:26:17 ulefr01-inspiron kernel: [21364.250385] usb 2-1: Device not responding to setup address.
\r\nMar  7 23:26:30 ulefr01-inspiron kernel: [21376.719336] usb 2-1: USB disconnect, device number 7
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.371177] usb 2-1: new SuperSpeed Gen 1 USB device number 8 using xhci_hcd
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.392184] usb 2-1: New USB device found, idVendor=174c, idProduct=55aa, bcdDevice= 1.00
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.392194] usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.392200] usb 2-1: Product: ASM105x
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.392205] usb 2-1: Manufacturer: ASMT
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.392209] usb 2-1: SerialNumber: 00000000000000000000
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.400872] scsi host2: uas
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.401521] scsi 2:0:0:0: Direct-Access     ASMT     2115             0    PQ: 0 ANSI: 6
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.402237] sd 2:0:0:0: Attached scsi generic sg2 type 0
\r\nMar  7 23:26:42 ulefr01-inspiron kernel: [21389.402319] sd 2:0:0:0: [sdc] Spinning up disk...
\r\nMar  7 23:26:42 ulefr01-inspiron mtp-probe: checking bus 2, device 8: "/sys/devices/pci0000:00/0000:00:14.0/usb2/2-1"
\r\nMar  7 23:26:42 ulefr01-inspiron mtp-probe: bus: 2, device: 8 was not an MTP device
\r\nMar  7 23:26:43 ulefr01-inspiron mtp-probe: checking bus 2, device 8: "/sys/devices/pci0000:00/0000:00:14.0/usb2/2-1"
\r\nMar  7 23:26:43 ulefr01-inspiron mtp-probe: bus: 2, device: 8 was not an MTP device
\r\nMar  7 23:26:46 ulefr01-inspiron kernel: [21390.407080] ...ready
\r\nMar  7 23:26:46 ulefr01-inspiron kernel: [21392.464264] sd 2:0:0:0: [sdc] 625142448 512-byte logical blocks: (320 GB/298 GiB)
\r\nMar  7 23:26:46 ulefr01-inspiron kernel: [21392.464372] sd 2:0:0:0: [sdc] Write Protect is off
\r\nMar  7 23:26:46 ulefr01-inspiron kernel: [21392.464564] sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
\r\nMar  7 23:26:46 ulefr01-inspiron kernel: [21392.464801] sd 2:0:0:0: [sdc] Optimal transfer size 33553920 bytes
\r\nMar  7 23:26:46 ulefr01-inspiron kernel: [21392.546305]  sdc: sdc1
\r\nMar  7 23:26:46 ulefr01-inspiron kernel: [21392.565111] sd 2:0:0:0: [sdc] Attached SCSI disk
\r\nMar  7 23:26:46 ulefr01-inspiron kernel: [21393.389949] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: errors=remount-ro
\r\nMar  7 23:26:46 ulefr01-inspiron udisksd[851]: Mounted /dev/sdc1 at /media/ulefr01/Hitachi1 on behalf of uid 1000
\r\nMar  7 23:27:43 ulefr01-inspiron kernel: [21450.359209] usb 2-1: USB disconnect, device number 8
\r\nMar  7 23:27:43 ulefr01-inspiron kernel: [21450.366354] sd 2:0:0:0: [sdc] Synchronizing SCSI cache
\r\nMar  7 23:27:43 ulefr01-inspiron udisksd[851]: Cleaning up mount point /media/ulefr01/Hitachi1 (device 8:33 no longer exists)
\r\nMar  7 23:27:44 ulefr01-inspiron kernel: [21450.603148] sd 2:0:0:0: [sdc] Synchronize Cache(10) failed: Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
\r\nMar  7 23:28:12 ulefr01-inspiron kernel: [21478.599156] usb 2-1: new SuperSpeed Gen 1 USB device number 9 using xhci_hcd
\r\nMar  7 23:28:12 ulefr01-inspiron kernel: [21478.620704] usb 2-1: New USB device found, idVendor=1f75, idProduct=0611, bcdDevice= 0.06
\r\nMar  7 23:28:12 ulefr01-inspiron kernel: [21478.620714] usb 2-1: New USB device strings: Mfr=4, Product=5, SerialNumber=6
\r\nMar  7 23:28:12 ulefr01-inspiron kernel: [21478.620720] usb 2-1: SerialNumber: 20181206
\r\nMar  7 23:28:17 ulefr01-inspiron kernel: [21483.847181] usb 2-1: Set SEL for device-initiated U1 failed.
\r\nMar  7 23:28:22 ulefr01-inspiron kernel: [21488.967176] usb 2-1: Enable of device-initiated U2 failed.
\r\nMar  7 23:28:22 ulefr01-inspiron kernel: [21488.967454] usb-storage 2-1:1.0: USB Mass Storage device detected
\r\nMar  7 23:28:22 ulefr01-inspiron kernel: [21488.968204] scsi host2: usb-storage 2-1:1.0
\r\nMar  7 23:28:22 ulefr01-inspiron mtp-probe: checking bus 2, device 9: "/sys/devices/pci0000:00/0000:00:14.0/usb2/2-1"
\r\nMar  7 23:28:22 ulefr01-inspiron mtp-probe: bus: 2, device: 9 was not an MTP device
\r\nMar  7 23:28:22 ulefr01-inspiron mtp-probe: checking bus 2, device 9: "/sys/devices/pci0000:00/0000:00:14.0/usb2/2-1"
\r\nMar  7 23:28:22 ulefr01-inspiron mtp-probe: bus: 2, device: 9 was not an MTP device
\r\nMar  7 23:28:59 ulefr01-inspiron kernel: [21526.343250] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
\r\n 

\r\n\r\n

 

\r\n\r\n

oplossing

\r\n\r\n

sudo modprobe xhci_hcd

\r\n\r\n

 

", "db_count": 65 }, { "taaknaam": "myarchive.py", "taaktext": "
\r\n#!/usr/bin/env python3.9\r\n# -*- coding: iso-8859-1 -*-\r\n# FSArchiver is a system tool that allows you to save the contents of a\r\n# file system to a compressed archive file. The file system can be restored\r\n# on a partition which has a different size and it can be restored on a\r\n# different file system.\r\n# Unlike tar/dar, FSArchiver also creates the file system when it extracts\r\n# the data to partitions.\r\n# Everything is checksummed in the archive in order to protect the data. If\r\n# the archive is corrupt, you just lose the current file, not the whole archive.\r\n#\r\n# It is possible to make consistent backups met fsarchiver if you are using LVM !\r\n# see http://www.system-rescue-cd.org/lvm-guide-en/Making-consistent-backups-with-LVM/\r\n#\r\n# To start this GUI application , you need root rights !\r\n#\r\n\"\"\"\r\nA GUI for fsarchiver using Python3 and Gtk3.0\r\nAuthor:  Franz Ulenaers\r\nVersion: 1.0\r\nDate: 2017/10/12\r\n\"\"\"\r\n\r\nimport gi, os, time, threading\r\ngi.require_version('Gtk', '3.0')\r\nfrom gi.repository import Gtk, Gdk\r\n\r\nglobal printdone, intervals\r\n\r\nprintdone = 1\r\nintervals = (\r\n    ('uren', 3600),\r\n    ('minuten', 60),\r\n    ('seconden', 1),\r\n    )\r\n\r\ndef display_time(seconds, granularity=3):\r\n    result = []\r\n    for name, count in intervals:\r\n        value = seconds // count\r\n        if value:\r\n            seconds -= value * count\r\n            if value == 1:\r\n                name = name.rstrip('s')\r\n            result.append(\"{} {}\".format(value, name))\r\n    return ', '.join(result[:granularity])\r\n\r\n\r\nclass ArchiverGUI(object):\r\n    def __init__(self):\r\n        window = Gtk.Window()\r\n        window.connect(\"destroy\", Gtk.main_quit)\r\n        vbox = Gtk.VBox(homogeneous=False, spacing=3, expand=False)\r\n\r\n        g = Gtk.Grid()\r\n        g.set_border_width(10)\r\n        g.set_row_spacing(5)\r\n        g.set_column_spacing(5)\r\n        vbox.add(g)\r\n\r\n        offset = 0\r\n        frame = self.new_frame(g, offset, 7)\r\n        label = Gtk.Label()\r\n        label.set_markup('<span font=\"12\" weight=\"bold\">Backup een bestandssysteem met fsarchiver</span>')\r\n        g.attach(label, 0, 0, 2, 1)\r\n        labels = [\"<b> Bestandsystemen te archiveren:</b>\",\r\n            \"<b> Foldernaam voor gearchiveerd bestand:</b>\",\r\n            \"<b> Gearchiveerd bestandsnaam:</b>\",\r\n            \"<b> Compressie nummer:</b>\",\r\n            \"<b> Aantal cpus/threads:</b>\",\r\n            \"<b> Splitsen in aantal blokken van 1G</b>\"]\r\n        for i in range(6):\r\n            label = Gtk.Label()\r\n            label.set_markup(labels[i])\r\n            g.attach(label, 0, 1 + i, 1, 1)\r\n\r\n        self.dev_list = self.get_device_labels()\r\n\r\n        self.fs_to_archive = Gtk.ComboBoxText.new_with_entry()\r\n        for d in self.dev_list:\r\n            self.fs_to_archive.append_text(d)\r\n        self.fs_to_archive.connect(\"changed\", self.set_default_archive_filename)\r\n        g.attach(self.fs_to_archive, 1, 1, 1, 1)\r\n\r\n        self.archive_file_path = Gtk.FileChooserButton()\r\n        self.archive_file_path.set_title(\"Directory in which to save archive\")\r\n        self.archive_file_path.set_current_folder(\"/\")\r\n        self.archive_file_path.set_action(Gtk.FileChooserAction.SELECT_FOLDER)\r\n        g.attach(self.archive_file_path, 1, 2, 1, 1)\r\n\r\n        self.create_archive_filename = Gtk.Entry()\r\n        g.attach(self.create_archive_filename, 1, 3, 1, 1)\r\n\r\n        self.compression_level = Gtk.ComboBoxText()\r\n        for i in range(1, 23):\r\n            self.compression_level.append_text(str(i))\r\n        g.attach(self.compression_level, 1, 4, 1, 1)\r\n\r\n        self.number_of_threads = Gtk.ComboBoxText()\r\n        for i in range(1, 6):\r\n            self.number_of_threads.append_text(str(i))\r\n        g.attach(self.number_of_threads, 1, 5, 1, 1)\r\n\r\n        self.number_of_blocks = Gtk.ComboBoxText()\r\n        for i in range(1, 7):\r\n            self.number_of_blocks.append_text(str(i))\r\n        g.attach(self.number_of_blocks, 1, 6, 1, 1)\r\n        #============================\r\n\r\n        offset = 8\r\n        frame = self.new_frame(g, offset, 5)\r\n\r\n        label = Gtk.Label()\r\n        label.set_markup('<span font=\"12\" weight=\"bold\">Terugzetten gearchiveerd bestandssysteem</span>')\r\n\r\n        g.attach(label, 0, offset, 2, 1)\r\n\r\n        labels = [\"<b>Archiveer bestandsnaam:</b>\",\r\n            \"<b>Positie in gearchiveerd bestand:</b>\",\r\n            \"<b>Terugzetten van bestandssysteem:</b>\"]\r\n        for i in range(3):\r\n            label = Gtk.Label()\r\n            label.set_markup(labels[i])\r\n            g.attach(label, 0, offset + 1 + i, 1, 1)\r\n\r\n        self.restore_archive_filename = Gtk.FileChooserButton()\r\n        self.restore_archive_filename.set_title(\"Bestand bevat gearchiveerd bestandssysteem:\")\r\n        self.restore_archive_filename.set_current_folder(\"/\")\r\n        self.restore_archive_filename.connect(\"file-set\", self.show_info_window)\r\n        g.attach(self.restore_archive_filename, 1, offset + 1, 1, 1)\r\n\r\n        self.archive_position = Gtk.ComboBoxText.new_with_entry()\r\n        self.archive_position.append_text(\"0\")\r\n        g.attach(self.archive_position, 1, offset + 2, 1, 1)\r\n\r\n        self.destination_filesystem = Gtk.ComboBoxText.new_with_entry()\r\n        for d in self.dev_list:\r\n            self.destination_filesystem.append_text(d)\r\n        g.attach(self.destination_filesystem, 1, offset + 3, 1, 1)\r\n\r\n        #============================\r\n\r\n        offset = 13\r\n        frame = self.new_frame(g, offset, 3)\r\n\r\n        btn_box = Gtk.HButtonBox()\r\n        frame.add(btn_box)\r\n\r\n        btn_box.set_layout(Gtk.ButtonBoxStyle.SPREAD)\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_QUIT)\r\n        btn.connect(\"clicked\", Gtk.main_quit)\r\n        btn_box.add(btn)\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_EXECUTE)\r\n        btn.connect(\"clicked\", self.gather_the_info)\r\n        btn_box.add(btn)\r\n\r\n        #============================\r\n\r\n        offset = 16\r\n        #frame = self.new_frame(g,offset,3)\r\n\r\n        self.status_label = Gtk.Label(label=\"Hier komt de status\")\r\n        #frame.add(self.status_label)\r\n        g.attach(self.status_label, 0, 16, 4, 1)\r\n\r\n        #============================\r\n\r\n        window.add(vbox)\r\n        window.show_all()\r\n\r\n        self.info_window = Gtk.Dialog(\"Gearchiveerde Informatie\")\r\n        c = self.info_window.get_content_area()\r\n        self.archive_info = Gtk.TextView()\r\n        c.add(self.archive_info)\r\n        a = self.info_window.get_action_area()\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)\r\n        btn.connect(\"clicked\", lambda x: self.info_window.hide())\r\n        a.add(btn)\r\n\r\n    # ---------------------------------\r\n\r\n    def display_time(seconds, granularity=3):\r\n        result = []\r\n        for name, count in intervals:\r\n            value = seconds // count\r\n            if value:\r\n                seconds -= value * count\r\n                if value == 1:\r\n                    name = name.rstrip('s')\r\n                result.append(\"{} {}\".format(value, name))\r\n        return ', '.join(result[:granularity])\r\n\r\n    # ----------------------------------\r\n\r\n    def new_frame(self, grid, top, height):\r\n        frame = Gtk.Frame()\r\n        # frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN)\r\n        grid.attach(frame, 0, top, 3, height)\r\n        return frame\r\n\r\n    # ---------------------------------\r\n\r\n    def gather_the_info(self, widget):\r\n        global printdone\r\n        global display_time\r\n        starttime = time.strftime('%H:%M:%S', time.localtime())\r\n\r\n        target = self.fs_to_archive.get_active_text()\r\n        target = target.strip()\r\n        try:\r\n            archive_name = self.restore_archive_filename.get_filename()\r\n        except:\r\n            archive_name = \"\"\r\n        if target:\r\n            path = self.archive_file_path.get_filename()\r\n            filename = self.create_archive_filename.get_text() + \"-\" + time.strftime(\"%Y%m%d%H%M\") + \".fsa\"\r\n            compression_level = self.compression_level.get_active() + 1\r\n            thread_count = self.number_of_threads.get_active() + 1\r\n            block_count = (self.number_of_blocks.get_active() + 1)*1000\r\n            my_cmd = \"sudo fsarchiver -A -Z \" + str(compression_level) + \\\r\n                \" -s \" + str(block_count) + \\\r\n                \" -j \" + str(thread_count) + \" savefs \" + path + \\\r\n                \"/\" + filename + \" \" + target\r\n            #print (\"my_cmd = \",my_cmd)\r\n        elif archive_name:\r\n            position = self.archive_position.get_active_text()\r\n            destination = self.destination_filesystem.get_active_text()\r\n            my_cmd = \"sudo fsarchiver restfs \" + archive_name + \\\r\n                \" id=\" + position + \",dest=\" + destination\r\n        print (\"my_cmd = \",my_cmd)\r\n        self.my_cmd = my_cmd\r\n        self.archiver_busy_flag = 1\r\n        t = threading.Thread(target=self.do_my_cmd)\r\n        t.start()\r\n        start_time = time.strftime('%H:%M:%S')\r\n        num_sec = 0\r\n        while self.archiver_busy_flag:\r\n            while Gtk.events_pending():\r\n                Gtk.main_iteration_do(False)\r\n            self.status_label.set_text(\"Start: \" + start_time + \" Run time: \" + display_time(num_sec, 3) + \" running\")\r\n            time.sleep(1)\r\n            num_sec += 1\r\n\r\n        if self.archiver_busy_flag == 0:\r\n            self.status_label.set_text(\"Start: \" + start_time + \" Run time: \" + display_time(num_sec, 3) + \" Done !\")\r\n            time.sleep(1)\r\n            while printdone == 0:\r\n                print (\"fsarchiver commando : \" + self.status_label.get_text())\r\n                printdone = 1\r\n        #\r\n\r\n    # ---------------------------------\r\n\r\n    def do_my_cmd(self):\r\n        global printdone\r\n        os.system(self.my_cmd)\r\n        self.archiver_busy_flag = 0\r\n        printdone = 0\r\n\r\n    # ---------------------------------\r\n\r\n    def show_info_window(self, widget):\r\n        target = self.restore_archive_filename.get_filename()\r\n        print (\"Gearchiveerde informatie van bestand = \", target)\r\n        my_cmd = 'sudo fsarchiver archinfo ' + target + ' 2>&1'\r\n        archinfo_msg = ''\r\n        print (\"archinfo cmd = \", my_cmd)\r\n        archinfo = os.popen(my_cmd, 'r')\r\n        line = archinfo.readline()\r\n        print (line)\r\n        knt = 1\r\n        while line:\r\n            archinfo_msg = archinfo_msg + line\r\n            line = archinfo.readline()\r\n            print (line)\r\n            knt += 1\r\n            if knt == 3:\r\n                words = line.split(' ')\r\n                try:\r\n                    archive_filecount = int(words[2])\r\n                    for i in range(archive_filecount):\r\n                        self.archive_position.append_text(str(i + 100))\r\n                except:\r\n                    continue\r\n        b = self.archive_info.get_buffer()\r\n        b.set_text(archinfo_msg)\r\n        self.info_window.show_all()\r\n\r\n    # ---------------------------------\r\n\r\n    def get_device_labels(self):\r\n        blkid = os.popen('sudo blkid -c /dev/null', 'r')\r\n        dev_list = {}\r\n        line = blkid.readline()\r\n        while (line):\r\n            mine = {}\r\n            line = line.replace('/dev', 'DEVICE=/dev')\r\n            line = line.replace(':', ' ')\r\n            line = line.split(' ')\r\n            for l in line:\r\n                if l.strip():\r\n                    m = l.split('=')\r\n                    m[1] = m[1].replace('\"', ' ')\r\n                    mine[m[0]] = m[1].strip()\r\n                break\r\n            try:\r\n                x = mine['LABEL']\r\n            except:\r\n                x = 'none'\r\n            dev_list[mine['DEVICE']] = x\r\n            line = blkid.readline()\r\n        return dev_list\r\n\r\n    # ---------------------------------\r\n\r\n    def set_default_archive_filename(self, widget):\r\n        f = self.fs_to_archive.get_active_text()\r\n        self.create_archive_filename.set_text(self.dev_list[f])\r\n\r\n    # ===============================\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    app = ArchiverGUI()\r\n    Gtk.main()\r\n#!/usr/bin/env python3.9\r\n# -*- coding: iso-8859-1 -*-\r\n# FSArchiver is a system tool that allows you to save the contents of a\r\n# file system to a compressed archive file. The file system can be restored\r\n# on a partition which has a different size and it can be restored on a\r\n# different file system.\r\n# Unlike tar/dar, FSArchiver also creates the file system when it extracts\r\n# the data to partitions.\r\n# Everything is checksummed in the archive in order to protect the data. If\r\n# the archive is corrupt, you just lose the current file, not the whole archive.\r\n#\r\n# It is possible to make consistent backups met fsarchiver if you are using LVM !\r\n# see http://www.system-rescue-cd.org/lvm-guide-en/Making-consistent-backups-with-LVM/\r\n#\r\n# To start this GUI application , you need root rights !\r\n#\r\n\"\"\"\r\nA GUI for fsarchiver using Python3 and Gtk3.0\r\nAuthor:  Franz Ulenaers\r\nVersion: 1.0\r\nDate: 2017/10/12\r\n\"\"\"\r\n\r\nimport gi, os, time, threading\r\ngi.require_version('Gtk', '3.0')\r\nfrom gi.repository import Gtk, Gdk\r\n\r\nglobal printdone, intervals\r\n\r\nprintdone = 1\r\nintervals = (\r\n    ('uren', 3600),\r\n    ('minuten', 60),\r\n    ('seconden', 1),\r\n    )\r\n\r\ndef display_time(seconds, granularity=3):\r\n    result = []\r\n    for name, count in intervals:\r\n        value = seconds // count\r\n        if value:\r\n            seconds -= value * count\r\n            if value == 1:\r\n                name = name.rstrip('s')\r\n            result.append(\"{} {}\".format(value, name))\r\n    return ', '.join(result[:granularity])\r\n\r\n\r\nclass ArchiverGUI(object):\r\n    def __init__(self):\r\n        window = Gtk.Window()\r\n        window.connect(\"destroy\", Gtk.main_quit)\r\n        vbox = Gtk.VBox(homogeneous=False, spacing=3, expand=False)\r\n\r\n        g = Gtk.Grid()\r\n        g.set_border_width(10)\r\n        g.set_row_spacing(5)\r\n        g.set_column_spacing(5)\r\n        vbox.add(g)\r\n\r\n        offset = 0\r\n        frame = self.new_frame(g, offset, 7)\r\n        label = Gtk.Label()\r\n        label.set_markup('<span font=\"12\" weight=\"bold\">Backup een bestandssysteem met fsarchiver</span>')\r\n        g.attach(label, 0, 0, 2, 1)\r\n        labels = [\"<b> Bestandsystemen te archiveren:</b>\",\r\n            \"<b> Foldernaam voor gearchiveerd bestand:</b>\",\r\n            \"<b> Gearchiveerd bestandsnaam:</b>\",\r\n            \"<b> Compressie nummer:</b>\",\r\n            \"<b> Aantal cpus/threads:</b>\",\r\n            \"<b> Splitsen in aantal blokken van 1G</b>\"]\r\n        for i in range(6):\r\n            label = Gtk.Label()\r\n            label.set_markup(labels[i])\r\n            g.attach(label, 0, 1 + i, 1, 1)\r\n\r\n        self.dev_list = self.get_device_labels()\r\n\r\n        self.fs_to_archive = Gtk.ComboBoxText.new_with_entry()\r\n        for d in self.dev_list:\r\n            self.fs_to_archive.append_text(d)\r\n        self.fs_to_archive.connect(\"changed\", self.set_default_archive_filename)\r\n        g.attach(self.fs_to_archive, 1, 1, 1, 1)\r\n\r\n        self.archive_file_path = Gtk.FileChooserButton()\r\n        self.archive_file_path.set_title(\"Directory in which to save archive\")\r\n        self.archive_file_path.set_current_folder(\"/\")\r\n        self.archive_file_path.set_action(Gtk.FileChooserAction.SELECT_FOLDER)\r\n        g.attach(self.archive_file_path, 1, 2, 1, 1)\r\n\r\n        self.create_archive_filename = Gtk.Entry()\r\n        g.attach(self.create_archive_filename, 1, 3, 1, 1)\r\n\r\n        self.compression_level = Gtk.ComboBoxText()\r\n        for i in range(1, 23):\r\n            self.compression_level.append_text(str(i))\r\n        g.attach(self.compression_level, 1, 4, 1, 1)\r\n\r\n        self.number_of_threads = Gtk.ComboBoxText()\r\n        for i in range(1, 6):\r\n            self.number_of_threads.append_text(str(i))\r\n        g.attach(self.number_of_threads, 1, 5, 1, 1)\r\n\r\n        self.number_of_blocks = Gtk.ComboBoxText()\r\n        for i in range(1, 7):\r\n            self.number_of_blocks.append_text(str(i))\r\n        g.attach(self.number_of_blocks, 1, 6, 1, 1)\r\n        #============================\r\n\r\n        offset = 8\r\n        frame = self.new_frame(g, offset, 5)\r\n\r\n        label = Gtk.Label()\r\n        label.set_markup('<span font=\"12\" weight=\"bold\">Terugzetten gearchiveerd bestandssysteem</span>')\r\n\r\n        g.attach(label, 0, offset, 2, 1)\r\n\r\n        labels = [\"<b>Archiveer bestandsnaam:</b>\",\r\n            \"<b>Positie in gearchiveerd bestand:</b>\",\r\n            \"<b>Terugzetten van bestandssysteem:</b>\"]\r\n        for i in range(3):\r\n            label = Gtk.Label()\r\n            label.set_markup(labels[i])\r\n            g.attach(label, 0, offset + 1 + i, 1, 1)\r\n\r\n        self.restore_archive_filename = Gtk.FileChooserButton()\r\n        self.restore_archive_filename.set_title(\"Bestand bevat gearchiveerd bestandssysteem:\")\r\n        self.restore_archive_filename.set_current_folder(\"/\")\r\n        self.restore_archive_filename.connect(\"file-set\", self.show_info_window)\r\n        g.attach(self.restore_archive_filename, 1, offset + 1, 1, 1)\r\n\r\n        self.archive_position = Gtk.ComboBoxText.new_with_entry()\r\n        self.archive_position.append_text(\"0\")\r\n        g.attach(self.archive_position, 1, offset + 2, 1, 1)\r\n\r\n        self.destination_filesystem = Gtk.ComboBoxText.new_with_entry()\r\n        for d in self.dev_list:\r\n            self.destination_filesystem.append_text(d)\r\n        g.attach(self.destination_filesystem, 1, offset + 3, 1, 1)\r\n\r\n        #============================\r\n\r\n        offset = 13\r\n        frame = self.new_frame(g, offset, 3)\r\n\r\n        btn_box = Gtk.HButtonBox()\r\n        frame.add(btn_box)\r\n\r\n        btn_box.set_layout(Gtk.ButtonBoxStyle.SPREAD)\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_QUIT)\r\n        btn.connect(\"clicked\", Gtk.main_quit)\r\n        btn_box.add(btn)\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_EXECUTE)\r\n        btn.connect(\"clicked\", self.gather_the_info)\r\n        btn_box.add(btn)\r\n\r\n        #============================\r\n\r\n        offset = 16\r\n        #frame = self.new_frame(g,offset,3)\r\n\r\n        self.status_label = Gtk.Label(label=\"Hier komt de status\")\r\n        #frame.add(self.status_label)\r\n        g.attach(self.status_label, 0, 16, 4, 1)\r\n\r\n        #============================\r\n\r\n        window.add(vbox)\r\n        window.show_all()\r\n\r\n        self.info_window = Gtk.Dialog(\"Gearchiveerde Informatie\")\r\n        c = self.info_window.get_content_area()\r\n        self.archive_info = Gtk.TextView()\r\n        c.add(self.archive_info)\r\n        a = self.info_window.get_action_area()\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)\r\n        btn.connect(\"clicked\", lambda x: self.info_window.hide())\r\n        a.add(btn)\r\n\r\n    # ---------------------------------\r\n\r\n    def display_time(seconds, granularity=3):\r\n        result = []\r\n        for name, count in intervals:\r\n            value = seconds // count\r\n            if value:\r\n                seconds -= value * count\r\n                if value == 1:\r\n                    name = name.rstrip('s')\r\n                result.append(\"{} {}\".format(value, name))\r\n        return ', '.join(result[:granularity])\r\n\r\n    # ----------------------------------\r\n\r\n    def new_frame(self, grid, top, height):\r\n        frame = Gtk.Frame()\r\n        # frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN)\r\n        grid.attach(frame, 0, top, 3, height)\r\n        return frame\r\n\r\n    # ---------------------------------\r\n\r\n    def gather_the_info(self, widget):\r\n        global printdone\r\n        global display_time\r\n        starttime = time.strftime('%H:%M:%S', time.localtime())\r\n\r\n        target = self.fs_to_archive.get_active_text()\r\n        target = target.strip()\r\n        try:\r\n            archive_name = self.restore_archive_filename.get_filename()\r\n        except:\r\n            archive_name = \"\"\r\n        if target:\r\n            path = self.archive_file_path.get_filename()\r\n            filename = self.create_archive_filename.get_text() + \"-\" + time.strftime(\"%Y%m%d%H%M\") + \".fsa\"\r\n            compression_level = self.compression_level.get_active() + 1\r\n            thread_count = self.number_of_threads.get_active() + 1\r\n            block_count = (self.number_of_blocks.get_active() + 1)*1000\r\n            my_cmd = \"sudo fsarchiver -A -Z \" + str(compression_level) + \\\r\n                \" -s \" + str(block_count) + \\\r\n                \" -j \" + str(thread_count) + \" savefs \" + path + \\\r\n                \"/\" + filename + \" \" + target\r\n            #print (\"my_cmd = \",my_cmd)\r\n        elif archive_name:\r\n            position = self.archive_position.get_active_text()\r\n            destination = self.destination_filesystem.get_active_text()\r\n            my_cmd = \"sudo fsarchiver restfs \" + archive_name + \\\r\n                \" id=\" + position + \",dest=\" + destination\r\n        print (\"my_cmd = \",my_cmd)\r\n        self.my_cmd = my_cmd\r\n        self.archiver_busy_flag = 1\r\n        t = threading.Thread(target=self.do_my_cmd)\r\n        t.start()\r\n        start_time = time.strftime('%H:%M:%S')\r\n        num_sec = 0\r\n        while self.archiver_busy_flag:\r\n            while Gtk.events_pending():\r\n                Gtk.main_iteration_do(False)\r\n            self.status_label.set_text(\"Start: \" + start_time + \" Run time: \" + display_time(num_sec, 3) + \" running\")\r\n            time.sleep(1)\r\n            num_sec += 1\r\n\r\n        if self.archiver_busy_flag == 0:\r\n            self.status_label.set_text(\"Start: \" + start_time + \" Run time: \" + display_time(num_sec, 3) + \" Done !\")\r\n            time.sleep(1)\r\n            while printdone == 0:\r\n                print (\"fsarchiver commando : \" + self.status_label.get_text())\r\n                printdone = 1\r\n        #\r\n\r\n    # ---------------------------------\r\n\r\n    def do_my_cmd(self):\r\n        global printdone\r\n        os.system(self.my_cmd)\r\n        self.archiver_busy_flag = 0\r\n        printdone = 0\r\n\r\n    # ---------------------------------\r\n\r\n    def show_info_window(self, widget):\r\n        target = self.restore_archive_filename.get_filename()\r\n        print (\"Gearchiveerde informatie van bestand = \", target)\r\n        my_cmd = 'sudo fsarchiver archinfo ' + target + ' 2>&1'\r\n        archinfo_msg = ''\r\n        print (\"archinfo cmd = \", my_cmd)\r\n        archinfo = os.popen(my_cmd, 'r')\r\n        line = archinfo.readline()\r\n        print (line)\r\n        knt = 1\r\n        while line:\r\n            archinfo_msg = archinfo_msg + line\r\n            line = archinfo.readline()\r\n            print (line)\r\n            knt += 1\r\n            if knt == 3:\r\n                words = line.split(' ')\r\n                try:\r\n                    archive_filecount = int(words[2])\r\n                    for i in range(archive_filecount):\r\n                        self.archive_position.append_text(str(i + 100))\r\n                except:\r\n                    continue\r\n        b = self.archive_info.get_buffer()\r\n        b.set_text(archinfo_msg)\r\n        self.info_window.show_all()\r\n\r\n    # ---------------------------------\r\n\r\n    def get_device_labels(self):\r\n        blkid = os.popen('sudo blkid -c /dev/null', 'r')\r\n        dev_list = {}\r\n        line = blkid.readline()\r\n        while (line):\r\n            mine = {}\r\n            line = line.replace('/dev', 'DEVICE=/dev')\r\n            line = line.replace(':', ' ')\r\n            line = line.split(' ')\r\n            for l in line:\r\n                if l.strip():\r\n                    m = l.split('=')\r\n                    m[1] = m[1].replace('\"', ' ')\r\n                    mine[m[0]] = m[1].strip()\r\n                break\r\n            try:\r\n                x = mine['LABEL']\r\n            except:\r\n                x = 'none'\r\n            dev_list[mine['DEVICE']] = x\r\n            line = blkid.readline()\r\n        return dev_list\r\n\r\n    # ---------------------------------\r\n\r\n    def set_default_archive_filename(self, widget):\r\n        f = self.fs_to_archive.get_active_text()\r\n        self.create_archive_filename.set_text(self.dev_list[f])\r\n\r\n    # ===============================\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    app = ArchiverGUI()\r\n    Gtk.main()\r\n
\r\n\r\n

 

", "db_count": 100 }, { "taaknaam": "myarchive_dir.py", "taaktext": "
\r\n#!/usr/bin/env python3.9\r\n# -*- coding: iso-8859-1 -*-\r\n# FSArchiver is a system tool that allows you to save the contents of a\r\n# file system to a compressed archive file. The file system can be restored\r\n# on a partition which has a different size and it can be restored on a\r\n# different file system.\r\n# Unlike tar/dar, FSArchiver also creates the file system when it extracts\r\n# the data to partitions.\r\n# Everything is checksummed in the archive in order to protect the data. If\r\n# the archive is corrupt, you just lose the current file, not the whole archive.\r\n#\r\n# It is possible to make consistent backups met fsarchiver if you are using LVM !\r\n# see http://www.system-rescue-cd.org/lvm-guide-en/Making-consistent-backups-with-LVM/\r\n#\r\n# To start this GUI application , you need root rights !\r\n#\r\n\"\"\"\r\nA GUI for fsarchiver using Python3 and Gtk3.0\r\nAuthor:  Franz Ulenaers\r\nVersion: 1.0\r\nDate: 2017/10/12\r\n\"\"\"\r\nimport gi, os, time, threading\r\ngi.require_version('Gtk', '3.0')\r\nfrom gi.repository import Gtk, Gdk\r\n\r\nglobal printdone, intervals\r\n\r\nprintdone = 1\r\nintervals = (\r\n    ('uren', 3600),\r\n    ('minuten', 60),\r\n    ('seconden', 1),\r\n    )\r\n\r\ndef display_time(seconds, granularity=3):\r\n    result = []\r\n    for name, count in intervals:\r\n        value = seconds // count\r\n        if value:\r\n            seconds -= value * count\r\n            if value == 1:\r\n                name = name.rstrip('s')\r\n            result.append(\"{} {}\".format(value, name))\r\n    return ', '.join(result[:granularity])\r\n\r\n\r\nclass ArchiverGUI(object):\r\n    def __init__(self):\r\n        window = Gtk.Window()\r\n        window.connect(\"destroy\", Gtk.main_quit)\r\n        vbox = Gtk.VBox(homogeneous=False, spacing=3, expand=False)\r\n\r\n        g = Gtk.Grid()\r\n        g.set_border_width(10)\r\n        g.set_row_spacing(5)\r\n        g.set_column_spacing(5)\r\n        vbox.add(g)\r\n\r\n        offset = 0\r\n        frame = self.new_frame(g, offset, 7)\r\n        label = Gtk.Label()\r\n        label.set_markup('<span font=\"12\" weight=\"bold\">Backup een bestandsfolder met fsarchiver</span>')\r\n        g.attach(label, 0, 0, 2, 1)\r\n        labels = [\"<b> Foldernaam te archiveren:</b>\",\r\n            \"<b> Foldernaam voor gearchiveerd bestand:</b>\",\r\n            \"<b> Gearchiveerd bestandsnaam:</b>\",\r\n            \"<b> Compressie nummer:</b>\",\r\n            \"<b> Aantal cpus/threads:</b>\",\r\n            \"<b> Splitsen in aantal blokken van 1G</b>\"]\r\n        for i in range(6):\r\n            label = Gtk.Label()\r\n            label.set_markup(labels[i])\r\n            g.attach(label, 0, 1 + i, 1, 1)\r\n\r\n        # self.dev_list = self.get_device_labels()\r\n\r\n        self.fn_to_archive = Gtk.FileChooserButton()\r\n        self.fn_to_archive.set_title(\"Directory te archiveren\")\r\n        self.fn_to_archive.set_current_folder(\"/\")\r\n        self.fn_to_archive.set_action(Gtk.FileChooserAction.SELECT_FOLDER)\r\n        g.attach(self.fn_to_archive, 1, 1, 1, 1)\r\n\r\n        self.archive_file_path = Gtk.FileChooserButton()\r\n        self.archive_file_path.set_title(\"Directory in which to save archive\")\r\n        self.archive_file_path.set_current_folder(\"/\")\r\n        self.archive_file_path.set_action(Gtk.FileChooserAction.SELECT_FOLDER)\r\n        g.attach(self.archive_file_path, 1, 2, 1, 1)\r\n\r\n        self.create_archive_filename = Gtk.Entry()\r\n        g.attach(self.create_archive_filename, 1, 3, 1, 1)\r\n\r\n        self.compression_level = Gtk.ComboBoxText()\r\n        for i in range(1, 23):\r\n            self.compression_level.append_text(str(i))\r\n        g.attach(self.compression_level, 1, 4, 1, 1)\r\n\r\n        self.number_of_threads = Gtk.ComboBoxText()\r\n        for i in range(1, 6):\r\n            self.number_of_threads.append_text(str(i))\r\n        g.attach(self.number_of_threads, 1, 5, 1, 1)\r\n\r\n        self.number_of_blocks = Gtk.ComboBoxText()\r\n        for i in range(1, 7):\r\n            self.number_of_blocks.append_text(str(i))\r\n        g.attach(self.number_of_blocks, 1, 6, 1, 1)\r\n        #============================\r\n\r\n        offset = 8\r\n        frame = self.new_frame(g, offset, 5)\r\n\r\n        label = Gtk.Label()\r\n        label.set_markup('<span font=\"12\" weight=\"bold\">Terugzetten gearchiveerd bestandssysteem</span>')\r\n\r\n        g.attach(label, 0, offset, 2, 1)\r\n\r\n        labels = [\"<b>Archiveer bestandsnaam:</b>\",\r\n            \"<b>Terugzetten naar foldernaam:</b>\"]\r\n        for i in range(2):\r\n            label = Gtk.Label()\r\n            label.set_markup(labels[i])\r\n            g.attach(label, 0, offset + 1 + i, 1, 1)\r\n\r\n        self.restore_archive_filename = Gtk.FileChooserButton()\r\n        self.restore_archive_filename.set_title(\"Bestand bevat gearchiveerd bestandssysteem:\")\r\n        self.restore_archive_filename.set_current_folder(\"/\")\r\n        self.restore_archive_filename.connect(\"file-set\", self.show_info_window)\r\n        g.attach(self.restore_archive_filename, 1, offset + 1, 1, 1)\r\n\r\n        # self.archive_position = Gtk.ComboBoxText.new_with_entry()\r\n        # self.archive_position.append_text(\"0\")\r\n        # g.attach(self.archive_position, 1, offset + 2, 1, 1)\r\n\r\n        self.destination_filesystem = Gtk.FileChooserButton()\r\n        self.destination_filesystem.set_title(\"Directory in which to save archive\")\r\n        self.destination_filesystem.set_current_folder(\"/\")\r\n        self.destination_filesystem.set_action(Gtk.FileChooserAction.SELECT_FOLDER)\r\n        g.attach(self.destination_filesystem, 1, offset + 2, 1, 1)\r\n        #============================\r\n\r\n        offset = 13\r\n        frame = self.new_frame(g, offset, 3)\r\n\r\n        btn_box = Gtk.HButtonBox()\r\n        frame.add(btn_box)\r\n\r\n        btn_box.set_layout(Gtk.ButtonBoxStyle.SPREAD)\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_QUIT)\r\n        btn.connect(\"clicked\", Gtk.main_quit)\r\n        btn_box.add(btn)\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_EXECUTE)\r\n        btn.connect(\"clicked\", self.gather_the_info)\r\n        btn_box.add(btn)\r\n\r\n        #============================\r\n\r\n        offset = 16\r\n        #frame = self.new_frame(g,offset,3)\r\n\r\n        self.status_label = Gtk.Label(label=\"Hier komt de status\")\r\n        #frame.add(self.status_label)\r\n        g.attach(self.status_label, 0, 16, 4, 1)\r\n\r\n        #============================\r\n\r\n        window.add(vbox)\r\n        window.show_all()\r\n\r\n        self.info_window = Gtk.Dialog(\"Gearchiveerde Informatie\")\r\n        c = self.info_window.get_content_area()\r\n        self.archive_info = Gtk.TextView()\r\n        c.add(self.archive_info)\r\n        a = self.info_window.get_action_area()\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)\r\n        btn.connect(\"clicked\", lambda x: self.info_window.hide())\r\n        a.add(btn)\r\n\r\n    # ---------------------------------\r\n\r\n    def display_time(seconds, granularity=3):\r\n        result = []\r\n        for name, count in intervals:\r\n            value = seconds // count\r\n            if value:\r\n                seconds -= value * count\r\n                if value == 1:\r\n                    name = name.rstrip('s')\r\n                result.append(\"{} {}\".format(value, name))\r\n        return ', '.join(result[:granularity])\r\n\r\n    # ----------------------------------\r\n\r\n    def new_frame(self, grid, top, height):\r\n        frame = Gtk.Frame()\r\n        # frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN)\r\n        grid.attach(frame, 0, top, 3, height)\r\n        return frame\r\n\r\n    # ---------------------------------\r\n\r\n    def gather_the_info(self, widget):\r\n        global printdone\r\n        global display_time\r\n        starttime = time.strftime('%H:%M:%S', time.localtime())\r\n\r\n        archive_name = \"\"\r\n        archive_name = self.restore_archive_filename.get_filename()\r\n        print(archive_name)\r\n        if not(archive_name):\r\n            # destination = self.destination_filesystem.get_destination()\r\n            # if not(destination):\r\n            path2 = self.fn_to_archive.get_filename()\r\n            path = self.archive_file_path.get_filename()\r\n            filename = self.create_archive_filename.get_text() + \"-\" + time.strftime(\"%Y%m%d-%Hh%M\") + \".fsa\"\r\n            compression_level = self.compression_level.get_active() + 1\r\n            thread_count = self.number_of_threads.get_active() + 1\r\n            block_count = (self.number_of_blocks.get_active() + 1)*1000\r\n            my_cmd = \"sudo fsarchiver -A -Z \" + str(compression_level) + \\\r\n                \" -s \" + str(block_count) + \\\r\n                \" -j \" + str(thread_count) + \" savedir \" + path + \\\r\n                \"/\" + filename + \" \" + path2\r\n        #print (\"my_cmd = \",my_cmd)\r\n        else:\r\n            destination = self.destination_filesystem.get_filename()\r\n            my_cmd = \"sudo fsarchiver restdir \" + archive_name + \\\r\n                        \" \" + destination\r\n        print (\"my_cmd = \",my_cmd)\r\n        self.my_cmd = my_cmd\r\n        self.archiver_busy_flag = 1\r\n        t = threading.Thread(target=self.do_my_cmd)\r\n        t.start()\r\n        start_time = time.strftime('%H:%M:%S')\r\n        num_sec = 0\r\n        while self.archiver_busy_flag:\r\n            while Gtk.events_pending():\r\n                Gtk.main_iteration_do(False)\r\n            self.status_label.set_text(\"Start: \" + start_time + \" Run time: \" + display_time(num_sec, 3) + \" running\")\r\n            time.sleep(1)\r\n            num_sec += 1\r\n\r\n        if self.archiver_busy_flag == 0:\r\n            self.status_label.set_text(\"Start: \" + start_time + \" Run time: \" + display_time(num_sec, 3) + \" Done !\")\r\n            time.sleep(1)\r\n            while printdone == 0:\r\n                print (\"fsarchiver commando : \" + self.status_label.get_text())\r\n                printdone = 1\r\n        #\r\n\r\n    # ---------------------------------\r\n\r\n    def do_my_cmd(self):\r\n        global printdone\r\n        os.system(self.my_cmd)\r\n        self.archiver_busy_flag = 0\r\n        printdone = 0\r\n\r\n    # ---------------------------------\r\n\r\n    def show_info_window(self, widget):\r\n        target = self.restore_archive_filename.get_filename()\r\n        print (\"Gearchiveerde informatie van bestand = \", target)\r\n        my_cmd = 'sudo fsarchiver archinfo ' + target + ' 2>&1'\r\n        archinfo_msg = ''\r\n        print (\"archinfo cmd = \", my_cmd)\r\n        archinfo = os.popen(my_cmd, 'r')\r\n        line = archinfo.readline()\r\n        print (line)\r\n        knt = 1\r\n        while line:\r\n            archinfo_msg = archinfo_msg + line\r\n            line = archinfo.readline()\r\n            print (line)\r\n            knt += 1\r\n            if knt == 3:\r\n                words = line.split(' ')\r\n                try:\r\n                    archive_filecount = int(words[2])\r\n                    for i in range(archive_filecount):\r\n                        self.archive_position.append_text(str(i + 100))\r\n                except:\r\n                    continue\r\n        b = self.archive_info.get_buffer()\r\n        b.set_text(archinfo_msg)\r\n        self.info_window.show_all()\r\n\r\n    # ---------------------------------\r\n\r\n\r\n    # ---------------------------------\r\n\r\n\r\n\r\n    # ===============================\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    app = ArchiverGUI()\r\n    Gtk.main()\r\n
\r\n\r\n

 

", "db_count": 73 }, { "taaknaam": "myarchive_snapshot.py", "taaktext": "
\r\n#!/usr/bin/env python3.9\r\n# -*- coding: iso-8859-1 -*-\r\n# FSArchiver is a system tool that allows you to save the contents of a\r\n# file system to a compressed archive file. The file system can be restored\r\n# on a partition which has a different size and it can be restored on a\r\n# different file system.\r\n# Unlike tar/dar, FSArchiver also creates the file system when it extracts\r\n# the data to partitions.\r\n# Everything is checksummed in the archive in order to protect the data. If\r\n# the archive is corrupt, you just lose the current file, not the whole archive.\r\n#\r\n# It is possible to make consistent backups met fsarchiver if you are using LVM !\r\n# see http://www.system-rescue-cd.org/lvm-guide-en/Making-consistent-backups-with-LVM/\r\n#\r\n# voor de restore wordt geen snapshot gebruikt !\r\n# wanneer een snapshot gebruikt wordt dan heb je minstens 6G nodig om de logische snapshot = mysnap te cre�ren op je volumegroup !\r\n# het is dezelfde volumegroep die gebruikt wordt als voor alle te backuppen logische volumen !\r\n# To start this GUI application , you need root rights !\r\n#\r\n# be sure you have at least 6G free on /dev/myssd !!\r\n#\r\n\"\"\"\r\nA GUI for fsarchiver using Python3 and Gtk3.0\r\nAuthor:  Franz Ulenaers\r\nVersion: 1.0\r\nDate: 2017/10/12\r\n\"\"\"\r\nimport gi, os, time, threading\r\ngi.require_version('Gtk', '3.0')\r\nfrom gi.repository import Gtk, Gdk\r\n\r\nglobal printdone, intervals\r\n\r\nprintdone = 1\r\nintervals = (\r\n    ('uren', 3600),\r\n    ('minuten', 60),\r\n    ('seconden', 1),\r\n    )\r\n\r\ndef display_time(seconds, granularity=3):\r\n    result = []\r\n    for name, count in intervals:\r\n        value = seconds // count\r\n        if value:\r\n            seconds -= value * count\r\n            if value == 1:\r\n                name = name.rstrip('s')\r\n            result.append(\"{} {}\".format(value, name))\r\n    return ', '.join(result[:granularity])\r\n\r\n\r\nclass ArchiverGUI(object):\r\n    def __init__(self):\r\n        window = Gtk.Window()\r\n        window.connect(\"destroy\", Gtk.main_quit)\r\n        vbox = Gtk.VBox(homogeneous=False, spacing=3, expand=False)\r\n\r\n        g = Gtk.Grid()\r\n        g.set_border_width(10)\r\n        g.set_row_spacing(5)\r\n        g.set_column_spacing(5)\r\n        vbox.add(g)\r\n\r\n        offset = 0\r\n        frame = self.new_frame(g, offset, 8)\r\n        label = Gtk.Label()\r\n        label.set_markup('<span font=\"12\" weight=\"bold\">Backup een bestandssysteem met fsarchiver</span>')\r\n        g.attach(label, 0, 0, 2, 1)\r\n        labels = [\"<b> Bestandsystemen te archiveren:</b>\",\r\n                  \"<b> als snapshot:</b>\",\r\n            \"<b> Foldernaam voor gearchiveerd bestand:</b>\",\r\n            \"<b> Gearchiveerd bestandsnaam:</b>\",\r\n            \"<b> Compressie nummer:</b>\",\r\n            \"<b> Aantal cpus/threads:</b>\",\r\n            \"<b> Splitsen in aantal blokken van 1G</b>\"]\r\n        for i in range(7):\r\n            label = Gtk.Label()\r\n            label.set_markup(labels[i])\r\n            g.attach(label, 0, 1 + i, 1, 1)\r\n\r\n        self.dev_list = self.get_device_labels()\r\n\r\n        self.fs_to_archive = Gtk.ComboBoxText.new_with_entry()\r\n        for d in self.dev_list:\r\n            self.fs_to_archive.append_text(d)\r\n        self.fs_to_archive.connect(\"changed\", self.set_default_archive_filename)\r\n        g.attach(self.fs_to_archive, 1, 1, 1, 1)\r\n\r\n        self.check_snapshot = Gtk.CheckButton(\"Snapshot\")\r\n        self.check_snapshot.connect(\"toggled\", self.on_snapshot_toggled)\r\n        self.check_snapshot.set_active(False)\r\n        g.attach(self.check_snapshot, 1, 2, 1, 1)\r\n\r\n        self.archive_file_path = Gtk.FileChooserButton()\r\n        self.archive_file_path.set_title(\"Directory in which to save archive\")\r\n        self.archive_file_path.set_current_folder(\"/\")\r\n        self.archive_file_path.set_action(Gtk.FileChooserAction.SELECT_FOLDER)\r\n        g.attach(self.archive_file_path, 1, 3, 1, 1)\r\n\r\n        self.create_archive_filename = Gtk.Entry()\r\n        g.attach(self.create_archive_filename, 1, 4, 1, 1)\r\n\r\n        self.compression_level = Gtk.ComboBoxText()\r\n        for i in range(1, 23):\r\n            self.compression_level.append_text(str(i))\r\n        g.attach(self.compression_level, 1, 5, 1, 1)\r\n\r\n        self.number_of_threads = Gtk.ComboBoxText()\r\n        for i in range(1, 6):\r\n            self.number_of_threads.append_text(str(i))\r\n        g.attach(self.number_of_threads, 1, 6, 1, 1)\r\n\r\n        self.number_of_blocks = Gtk.ComboBoxText()\r\n        for i in range(1, 7):\r\n            self.number_of_blocks.append_text(str(i))\r\n        g.attach(self.number_of_blocks, 1, 7, 1, 1)\r\n        #============================\r\n\r\n        offset = 8\r\n        frame = self.new_frame(g, offset, 5)\r\n\r\n        label = Gtk.Label()\r\n        label.set_markup('<span font=\"12\" weight=\"bold\">Terugzetten gearchiveerd bestandssysteem</span>')\r\n\r\n        g.attach(label, 0, offset, 2, 1)\r\n\r\n        labels = [\"<b>Archiveer bestandsnaam:</b>\",\r\n            \"<b>Positie in gearchiveerd bestand:</b>\",\r\n            \"<b>Terugzetten van bestandssysteem:</b>\"]\r\n        for i in range(3):\r\n            label = Gtk.Label()\r\n            label.set_markup(labels[i])\r\n            g.attach(label, 0, offset + 1 + i, 1, 1)\r\n\r\n        self.restore_archive_filename = Gtk.FileChooserButton()\r\n        self.restore_archive_filename.set_title(\"Bestand bevat gearchiveerd bestandssysteem:\")\r\n        self.restore_archive_filename.set_current_folder(\"/\")\r\n        self.restore_archive_filename.connect(\"file-set\", self.show_info_window)\r\n        g.attach(self.restore_archive_filename, 1, offset + 1, 1, 1)\r\n\r\n        self.archive_position = Gtk.ComboBoxText.new_with_entry()\r\n        self.archive_position.append_text(\"0\")\r\n        g.attach(self.archive_position, 1, offset + 2, 1, 1)\r\n\r\n        self.destination_filesystem = Gtk.ComboBoxText.new_with_entry()\r\n        for d in self.dev_list:\r\n            self.destination_filesystem.append_text(d)\r\n        g.attach(self.destination_filesystem, 1, offset + 3, 1, 1)\r\n\r\n        #============================\r\n\r\n        offset = 13\r\n        frame = self.new_frame(g, offset, 3)\r\n\r\n        btn_box = Gtk.HButtonBox()\r\n        frame.add(btn_box)\r\n\r\n        btn_box.set_layout(Gtk.ButtonBoxStyle.SPREAD)\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_QUIT)\r\n        btn.connect(\"clicked\", Gtk.main_quit)\r\n        btn_box.add(btn)\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_EXECUTE)\r\n        btn.connect(\"clicked\", self.gather_the_info)\r\n        btn_box.add(btn)\r\n\r\n        #============================\r\n\r\n        offset = 16\r\n        #frame = self.new_frame(g,offset,3)\r\n\r\n        self.status_label = Gtk.Label(label=\"Hier komt de status\")\r\n        #frame.add(self.status_label)\r\n        g.attach(self.status_label, 0, 16, 4, 1)\r\n\r\n        #============================\r\n\r\n        window.add(vbox)\r\n        window.show_all()\r\n\r\n        self.info_window = Gtk.Dialog(\"Gearchiveerde Informatie\")\r\n        c = self.info_window.get_content_area()\r\n        self.archive_info = Gtk.TextView()\r\n        c.add(self.archive_info)\r\n        a = self.info_window.get_action_area()\r\n        btn = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)\r\n        btn.connect(\"clicked\", lambda x: self.info_window.hide())\r\n        a.add(btn)\r\n\r\n    # ---------------------------------\r\n\r\n    def on_snapshot_toggled(self, button):\r\n        value = button.get_active()\r\n        self.check_snapshot.set_active(value)\r\n\r\n\r\n    def display_time(seconds, granularity=3):\r\n        result = []\r\n        for name, count in intervals:\r\n            value = seconds // count\r\n            if value:\r\n                seconds -= value * count\r\n                if value == 1:\r\n                    name = name.rstrip('s')\r\n                result.append(\"{} {}\".format(value, name))\r\n        return ', '.join(result[:granularity])\r\n\r\n    # ----------------------------------\r\n\r\n    def new_frame(self, grid, top, height):\r\n        frame = Gtk.Frame()\r\n        # frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN)\r\n        grid.attach(frame, 0, top, 3, height)\r\n        return frame\r\n\r\n    # ---------------------------------\r\n\r\n    def gather_the_info(self, widget):\r\n        global printdone\r\n        global display_time\r\n        starttime = time.strftime('%H:%M:%S', time.localtime())\r\n\r\n        target = self.fs_to_archive.get_active_text()\r\n        target = target.strip()\r\n        try:\r\n            archive_name = self.restore_archive_filename.get_filename()\r\n        except:\r\n            archive_name = \"\"\r\n        if target:\r\n            if self.check_snapshot.get_active():\r\n                my_cmd0 = \"sudo lvcreate -L 6G -s -n mysnap \" + target\r\n                # my_cmd2 = \"sudo lvremove -vf \" + target\r\n                l=target.split(\"/\")\r\n                #print(\"l 0 =\",l[0])\r\n                #print(\"l 1 =\",l[1])\r\n                #print(\"l 2 =\",l[2])\r\n                #print(\"l 3 =\",l[3])\r\n                ll = l[3].split(\"-\")\r\n                target2 = \"/\"+l[1]+\"/\"+l[2]+\"/\"+ll[0]+\"-\"+\"mysnap\"\r\n                my_cmd2 = \"sudo lvremove -vf \" + target2\r\n                #print(\"target2 =\",target2)\r\n            else:\r\n                target2 = target\r\n            path = self.archive_file_path.get_filename()\r\n            filename = self.create_archive_filename.get_text() + \"-\" + time.strftime(\"%Y%m%d%H%M\") + \".fsa\"\r\n            compression_level = self.compression_level.get_active() + 1\r\n            thread_count = self.number_of_threads.get_active() + 1\r\n            block_count = (self.number_of_blocks.get_active() + 1)*1000\r\n            my_cmd = \"sudo fsarchiver -A -Z \" + str(compression_level) + \\\r\n                \" -s \" + str(block_count) + \\\r\n                \" -j \" + str(thread_count) + \" savefs \" + path + \\\r\n                \"/\" + filename + \" \" + target2\r\n            #print (\"my_cmd0 =\",my_cmd0)\r\n            #print (\"my_cmd = \",my_cmd)\r\n            #print (\"my_cmd2 =\",my_cmd2)\r\n        elif archive_name:\r\n            position = self.archive_position.get_active_text()\r\n            destination = self.destination_filesystem.get_active_text()\r\n            my_cmd = \"sudo fsarchiver restfs \" + archive_name + \\\r\n                \" id=\" + position + \",dest=\" + destination\r\n\r\n        #print (\"my_cmd0 = \",my_cmd0)\r\n        #print (\"my_cmd = \",my_cmd)\r\n        #print (\"my_cmd2 = \",my_cmd2)\r\n        if self.check_snapshot.get_active():\r\n            self.my_cmd = my_cmd0 + \" && \" + my_cmd + \" && \" + my_cmd2\r\n        else:\r\n            self.my_cmd = my_cmd\r\n\r\n        print (\"my_cmd = \", self.my_cmd)\r\n        self.archiver_busy_flag = 1\r\n\r\n        t = threading.Thread(target=self.do_my_cmd)\r\n        t.start()\r\n        start_time = time.strftime('%H:%M:%S')\r\n        num_sec = 0\r\n\r\n        while self.archiver_busy_flag:\r\n            while Gtk.events_pending():\r\n                Gtk.main_iteration_do(False)\r\n            self.status_label.set_text(\"Start: \" + start_time + \" Run time: \" + display_time(num_sec, 3) + \" running\")\r\n            time.sleep(1)\r\n            num_sec += 1\r\n\r\n        if self.archiver_busy_flag == 0:\r\n            self.status_label.set_text(\"Start: \" + start_time + \" Run time: \" + display_time(num_sec, 3) + \" Done !\")\r\n            time.sleep(1)\r\n            while printdone == 0:\r\n                print (\"fsarchiver commando : \" + self.status_label.get_text())\r\n                printdone = 1\r\n        #\r\n\r\n    # ---------------------------------\r\n\r\n    def do_my_cmd(self):\r\n        global printdone\r\n        os.system(self.my_cmd)\r\n        self.archiver_busy_flag = 0\r\n        printdone = 0\r\n\r\n\r\n    # ---------------------------------\r\n\r\n    def show_info_window(self, widget):\r\n        target = self.restore_archive_filename.get_filename()\r\n        print (\"Gearchiveerde informatie van bestand = \", target)\r\n        my_cmd = 'sudo fsarchiver archinfo ' + target + ' 2>&1'\r\n        archinfo_msg = ''\r\n        print (\"archinfo cmd = \", my_cmd)\r\n        archinfo = os.popen(my_cmd, 'r')\r\n        line = archinfo.readline()\r\n        print (line)\r\n        knt = 1\r\n        while line:\r\n            archinfo_msg = archinfo_msg + line\r\n            line = archinfo.readline()\r\n            print (line)\r\n            knt += 1\r\n            if knt == 3:\r\n                words = line.split(' ')\r\n                try:\r\n                    archive_filecount = int(words[2])\r\n                    for i in range(archive_filecount):\r\n                        self.archive_position.append_text(str(i + 100))\r\n                except:\r\n                    continue\r\n        b = self.archive_info.get_buffer()\r\n        b.set_text(archinfo_msg)\r\n        self.info_window.show_all()\r\n\r\n    # ---------------------------------\r\n\r\n    def get_device_labels(self):\r\n        blkid = os.popen('sudo blkid -c /dev/null', 'r')\r\n        dev_list = {}\r\n        line = blkid.readline()\r\n        while (line):\r\n            mine = {}\r\n            line = line.replace('/dev', 'DEVICE=/dev')\r\n            line = line.replace(':', ' ')\r\n            line = line.split(' ')\r\n            for l in line:\r\n                if l.strip():\r\n                    m = l.split('=')\r\n                    m[1] = m[1].replace('\"', ' ')\r\n                    mine[m[0]] = m[1].strip()\r\n                break\r\n            try:\r\n                x = mine['LABEL']\r\n            except:\r\n                x = 'none'\r\n            dev_list[mine['DEVICE']] = x\r\n            line = blkid.readline()\r\n        return dev_list\r\n\r\n    # ---------------------------------\r\n\r\n    def set_default_archive_filename(self, widget):\r\n        f = self.fs_to_archive.get_active_text()\r\n        self.create_archive_filename.set_text(self.dev_list[f])\r\n\r\n    # ===============================\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    app = ArchiverGUI()\r\n    Gtk.main()\r\n
\r\n\r\n

 

", "db_count": 71 }, { "taaknaam": "setup loop device", "taaktext": "

Setup loop device

\r\n\r\n

sudo modprobe loop

\r\n\r\n

mkdir /myssd2_data/tmp

\r\n\r\n

dd if=/dev/zero of=/myssd2_data/tmp/test.ext4 bs=1G count=20

\r\n\r\n

losetup --find --show test.ext4

\r\n\r\n

    shows /dev/loop0

\r\n\r\n

sudo mkfs.ext4 /dev/loop0

\r\n\r\n

fsarchiver restfs  myssd2_data/backup-data----.fsa id=0,dest=/dev/loop0

\r\n\r\n

mkdir /myssd2_data/tmp/tmp

\r\n\r\n

sudo mount /dev/loop0 tmp

\r\n\r\n

ls tmp/*

\r\n\r\n

sudo umount tmp

\r\n\r\n

rm test.ext4

\r\n\r\n

losetup -d /dev/loop0

\r\n\r\n

sudo rmmod loop

", "db_count": 93 }, { "taaknaam": "signatures where invalid EXPKEYSIG xyzxyzxyz", "taaktext": "

sudo apt-key list

\r\n\r\n

sudo apt-key adv --keyserver keyring.debian.org --recv-keys  xyzxyzxyz

\r\n\r\n

expired key 

\r\n\r\n\r\n\r\n

delete key

\r\n\r\n

sudo apt-key del  xyzxyzxyz

\r\n\r\n

keyservers

\r\n\r\n", "db_count": 81 }, { "taaknaam": "sources.list\r\nsources.list.d lists", "taaktext": "

sources.list

\r\n\r\n

deb  http://ftp.be.debian.org/debian/  bullseye  main  contrib  non-free

\r\n\r\n

deb https://security.debian.org/debian-security bullseye-security main contrib non-free

\r\n\r\n

deb  http://ftp.be.debian.org/debian/  bullseye-updates  main  contrib  non-free

\r\n\r\n

deb  http://ftp.be.debian.org/debian/  bullseye-backports  main  contrib  non-free

\r\n\r\n

sources.list.d lists

\r\n\r\n

atom list

\r\n\r\n\r\n\r\n

bluemail.list

\r\n\r\n\r\n\r\n

eid.list

\r\n\r\n\r\n\r\n

experimental.list

\r\n\r\n\r\n\r\n

teams.list

\r\n\r\n\r\n\r\n

          teamviewer.list

\r\n\r\n\r\n\r\n

 

", "db_count": 88 }, { "taaknaam": "tune all ext4 filesystemen", "taaktext": "

Tune all ext4 betsandsystemen

\r\n\r\n

Herstart Inspiron laptop met usbstick 32 MB

\r\n\r\n

selecteer systemrescue cd en opstarten in RAM mode

\r\n\r\n

startx

\r\n\r\n

settings keyboard

\r\n\r\n

    layout

\r\n\r\n

        system mode afzetten

\r\n\r\n

        add layout belgian

\r\n\r\n

        remove US keyboard

\r\n\r\n

console 

\r\n\r\n

    cd /mnt

\r\n\r\n

    mkdir home

\r\n\r\n

mount /dev/mapper/myssd-home home

\r\n\r\n

cd home/ulefr01/utils

\r\n\r\n

cp tune_ext4 /tmp/.

\r\n\r\n

cd /mnt

\r\n\r\n

umount home

\r\n\r\n

cd /tmp

\r\n\r\n

lsblk

\r\n\r\n

./tune_ext4 

\r\n\r\n\r\n\r\n

fsck -V /dev/sda1

\r\n\r\n

fsck -V /dev/sda2 

\r\n\r\n\r\n\r\n

mount Hitachi2

\r\n\r\n\r\n\r\n

umount Hitachi2

\r\n\r\n

mount Crucial

\r\n\r\n\r\n\r\n

umount Crucial

\r\n\r\n

mount Hitachi1

\r\n\r\n\r\n\r\n

umount Hitachi1

\r\n\r\n

mount Hitachi4

\r\n\r\n\r\n\r\n

umount Hitachi4

\r\n\r\n

mount Hitachi3

\r\n\r\n\r\n\r\n

umount Hitachi3

\r\n\r\n

mount Netac

\r\n\r\n\r\n\r\n

umount Netac        

\r\n\r\n

mount Inateck (myssd2_data, ...)

\r\n\r\n\r\n\r\n

​​​​​​​

", "db_count": 66 }, { "taaknaam": "tune_ext4", "taaktext": "
\r\n

#!/bin/bash
\r\n# tune_ext4
\r\nARGS=1
\r\nE_BADARGS=65
\r\nif [ $# -ne "$ARGS" ]
\r\nthen
\r\n   echo "Usage: `basename $0` device"
\r\n   exit $E_BADARGS
\r\nfi
\r\ndevice=$1
\r\necho 'tune_ext4'
\r\necho '---------'
\r\necho "device= $device"
\r\necho "doe : tune2fs -O ^has_journal $device"
\r\n# verwijder de journal en maak er een ext2 bestandensysteem
\r\ntune2fs -O ^has_journal $device
\r\necho "doe : e2fsck -f $device"
\r\n# check ext2 bestandensysteem op fouten en herstel ze
\r\ne2fsck -fy $device
\r\n# journal opties zijn :  
\r\n#        journal_data_ordered
\r\n#        journal_data
\r\n#        journal_data_writeback
\r\necho "doe : tune2fs -J size=4 -o journal_data_ordered $DEVICE"
\r\n# echo "doe : tune2fs -o journal_data_writeback $DEVICE"
\r\n# hermaak journal en maak ext3
\r\ntune2fs -J size=4 -o journal_data_ordered $device
\r\necho "doe : tune2fs -O extents,uninit_bg,dir_index,extra_isize -i 6m -c 200 -m 1 $device"
\r\n# -i 6m -c 200 -m 1 $device"
\r\n# maak een ext3 -6m om de 6 maanden hercheck bestandensysteem of -c 200 200 keren mounten vooraleer hercheck
\r\n# ipv -i 7d -c 15 -m 1 ...
\r\ntune2fs -O extents,uninit_bg,dir_index,extra_isize -i 6m -c 200 -m 1 $device
\r\necho "doe : e2fsck -pfD $device"
\r\n# maak een ext4 bestandensystemm
\r\ne2fsck -pfD $device
\r\necho "doe : e2fsck -f $device"
\r\ne2fsck -fy $device
\r\necho 'gedaan !'
\r\necho "device= $device"
\r\nexit 0

\r\n
", "db_count": 63 } ]