User Tools

Site Tools


sermn_wiki:userpages:marta:reserves_automatiques_manteniment_2022

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sermn_wiki:userpages:marta:reserves_automatiques_manteniment_2022 [2022/08/19 17:16]
miquel [Seguretat]
sermn_wiki:userpages:marta:reserves_automatiques_manteniment_2022 [2022/08/23 19:57] (current)
miquel [Dateutils]
Line 7: Line 7:
 **IMPORTANT:** Les reserves per les estones de manteniment es crearan automàticament amb vuit setmanes d'antelació, per tal que, si s'escau, hi hagi prou temps per modificar-les. **IMPORTANT:** Les reserves per les estones de manteniment es crearan automàticament amb vuit setmanes d'antelació, per tal que, si s'escau, hi hagi prou temps per modificar-les.
  
 +===== Instal·lar el paquet "dateutils" =====
  
-===== maintenance_bookings.sh =====+Instal·lo el paquet ''dateutils'' per facilitar el càlcul amb dates: 
 + 
 +<file> 
 +$ sudo apt install dateutils                    
 +[sudo] password for sermnadmin: ******                                      
 +Reading package lists... Done                                    
 +Building dependency tree                                               
 +Reading state information... Done                                     
 +The following NEW packages will be installed:                           
 +  dateutils                                    
 +0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded. 
 +Need to get 217 kB of archives.             
 +After this operation, 1,555 kB of additional disk space will be used. 
 +Get:1 http://ftp.es.debian.org/debian buster/main amd64 dateutils amd64 0.4.3-1 [217 kB] 
 +Fetched 217 kB in 0s (586 kB/s)    
 +Selecting previously unselected package dateutils.                    
 +(Reading database ... 253630 files and directories currently installed.) 
 +Preparing to unpack .../dateutils_0.4.3-1_amd64.deb ...            
 +Unpacking dateutils (0.4.3-1) ...                      
 +Setting up dateutils (0.4.3-1) ...                           
 +Processing triggers for install-info (6.5.0.dfsg.1-4+b1) ...     
 +Processing triggers for man-db (2.8.5-2) ...                    
 +</file> 
 + 
 + 
 +===== maintenance_bookings_2022.sh =====
  
 <WRAP todo> <WRAP todo>
Line 16: Line 42:
 Aquest es el programet que crea les reserves per l'estona de manteniment. S'executa tots els diumenges a les 3 de la matinada, i crea les reserves amb dues setmanes d'antelació per tal que es puguin modificar si s'escau. El programet també envia un correu electrònic indicant si ha pogut fer les reserves. Aquest es el programet que crea les reserves per l'estona de manteniment. S'executa tots els diumenges a les 3 de la matinada, i crea les reserves amb dues setmanes d'antelació per tal que es puguin modificar si s'escau. El programet també envia un correu electrònic indicant si ha pogut fer les reserves.
  
-<code bash maintenance_bookings.sh>+<code bash maintenance_bookings_2022.sh>
 #!/bin/bash #!/bin/bash
 # #
-maintenance_bookings.sh+maintenance_bookings_2022.sh
 # #
 # (c) 2013, Miquel Cabanas, SeRMN, UAB # (c) 2013, Miquel Cabanas, SeRMN, UAB
Line 212: Line 238:
  
 <WRAP todo> <WRAP todo>
-FIXME comprovar.+FIXME cal comprovar els permisos.
 </WRAP> </WRAP>
  
Line 226: Line 252:
 deny from all deny from all
 </file> </file>
 +
 +===== Documentació =====
 +
 +==== BASH date math ====
 +
 +  * [[https://www.linuxjournal.com/content/doing-date-math-command-line-part-i | Doing Date Math on the Command Line, Part I | Linux Journal.]]
 +    * [[https://www.linuxjournal.com/content/doing-date-math-command-line-part-ii | Doing Date Math on the Command Line, Part II | Linux Journal.]]
 +  * [[https://linuxconfig.org/addition-and-subtraction-arithmetics-with-linux-date-command | Addition and subtraction arithmetics with Linux date command - Linux Tutorials - Learn Linux Configuration.]]
 +  * [[https://www.shell-tips.com/bash/math-arithmetic-calculation/#gsc.tab=0 | Math Arithmetic: How To Do Calculation in Bash?]]
 +  * [[https://www.google.com/search?client=firefox-b-e&q=bash+date+arithmetic | bash date arithmetic - Cerca de Google.]]
 +
 +==== BASH modulus operator ====
 +
 +  * [[https://linuxhint.com/modulus-bash/ | How to Use Modulus in Bash?]]
 +  * [[https://tldp.org/LDP/abs/html/ops.html | 8.1. Operators,]] in Chapter 8. Operations and Related Topics. //Advanced Bash-Scripting Guide. An in-depth exploration of the art of shell scripting.// Mendel Cooper, 2014.
 +
 +
 +==== Debugging BASH ====
 +
 +  * [[https://www.baeldung.com/linux/debug-bash-script | Debugging a Bash Script.]]
 +  * [[https://www.shell-tips.com/bash/debug-script/ | 5 Simple Steps On How To Debug a Bash Shell Script.]]
 +  * [[https://tldp.org/LDP/abs/html/debugging.html | Chapter 32. Debugging.]] //Advanced Bash-Scripting Guide. An in-depth exploration of the art of shell scripting.// Mendel Cooper, 2014.
 +  * [[https://www.shellcheck.net/ | ShellCheck – shell script analysis tool.]]
 +    * [[https://github.com/koalaman/shellcheck | GitHub - koalaman/shellcheck: ShellCheck, a static analysis tool for shell scripts.]]
 +  * [[https://google.github.io/styleguide/shellguide.html | Google Shell Style Guide.]] Revision 2.02. Authored, revised and maintained by many Googlers.
 +    * [[https://unix.stackexchange.com/questions/449498/call-function-declared-below | call function declared below.]] :info: check recommnendations about ''main "$@"; exit'' and ''<nowiki>[[ ${BASH_SOURCE[0]} = "$0" ]]</nowiki> && Main "$@"''.
 +
 +
 +==== Dateutils ====
 +
 +  * [[http://www.fresse.org/dateutils/ | Dateutils]] are a bunch of tools that revolve around fiddling with dates and times in the command line with a strong focus on use cases that arise when dealing with large amounts of financial data.
 +    * [[https://github.com/hroptatyr/dateutils | GitHub - hroptatyr/dateutils:]] nifty command line date and time utilities; fast date calculations and conversion in the shell.
 +  * [[https://packages.debian.org/search?searchon=names&keywords=dateutils | Debian -- Package Search Results -- dateutils.]]
 +
 +
 +==== Cron ====
 +
 +  * [[https://en.wikipedia.org/wiki/Cron#CRON_expression | cron - Wikipedia.]]
 +  * [[https://crontab.guru/#20,50_7-13_*_*_* | Crontab.guru - The cron schedule expression editor.]]
 +  * [[https://unix.stackexchange.com/questions/210739/getting-crontab-events-that-would-happen-given-a-start-date-time
 +  * cron | Getting crontab events that would happen given a start date/time - Unix & Linux Stack Exchange.]]
  
  
sermn_wiki/userpages/marta/reserves_automatiques_manteniment_2022.1660922194.txt.gz · Last modified: 2022/08/19 17:16 by miquel