This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
sermn_wiki:userpages:marta:reserves_automatiques_manteniment [2013/10/28 17:53] miquel [service_bookings.sh] |
sermn_wiki:userpages:marta:reserves_automatiques_manteniment [2022/08/19 15:33] (current) miquel [Reserves automàtiques per l'estona de manteniment (de 2013-10 a 2022-03)] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Reserves automàtiques per l' | + | ====== Reserves automàtiques per l' |
| + | |||
| + | <WRAP info> | ||
| + | Els scripts i les tasques periòdiques programades ('' | ||
| + | |||
| + | La informació sobre els nous scripts i tasques periòdiques programades es troba a la pàgina [[sermn_wiki: | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | Després de veure que les [[sermn_wiki: | ||
| + | * fins ara les estones de manteniment estaven programades als horaris dels espectròmetres i eren fixes; | ||
| + | * a partir d' | ||
| + | |||
| + | És a dir, si cal, es podran modificar les reserves de les estones de manteniment. Per exemple: | ||
| + | * si es canvia el dia de manteniment, | ||
| + | * si la recàrrega de nitrogen líquid finalitza força abans que l' | ||
| + | * si algú vol reservar un espectròmetre el dia de manteniment i l' | ||
| + | |||
| + | **IMPORTANT: | ||
| - | FIXME explicar el programet per fer les reserves automàtiques per l' | ||
| ===== maintenance_bookings.sh ===== | ===== maintenance_bookings.sh ===== | ||
| - | Aquest es el programet que crea les reserves per l' | + | Aquest es el programet que crea les reserves per l' |
| <code bash maintenance_bookings.sh> | <code bash maintenance_bookings.sh> | ||
| #!/bin/bash | #!/bin/bash | ||
| # | # | ||
| - | # maintenance_nmr_bookings.sh | + | # maintenance_bookings.sh |
| # | # | ||
| # (c) 2013, Miquel Cabanas, SeRMN, UAB | # (c) 2013, Miquel Cabanas, SeRMN, UAB | ||
| Line 23: | Line 41: | ||
| # To run this script every Sunday 2am append an entry like, | # To run this script every Sunday 2am append an entry like, | ||
| # | # | ||
| - | # FIXME 0 3 * * 1 / | + | # FIXME 0 3 * * Sun / |
| # | # | ||
| # to crontab. This entry means, at minute 0, hour 2, on every (*) day of | # to crontab. This entry means, at minute 0, hour 2, on every (*) day of | ||
| Line 59: | Line 77: | ||
| # Bumblebee booking system database where everything gets stored | # Bumblebee booking system database where everything gets stored | ||
| - | myuser=' | + | myuser=' |
| - | mypass=' | + | mypass=' |
| - | mydb='bmbdb114' | + | mydb='*****' |
| Line 151: | Line 169: | ||
| -------- Original Message -------- | -------- Original Message -------- | ||
| Subject: SeRMN Booking System - Weekly maintenance reservations | Subject: SeRMN Booking System - Weekly maintenance reservations | ||
| - | Date: Mon, 28 Oct 2013 16:54:46 +0100 | + | Date: Sun, 27 Oct 2013 16:54:46 +0300 |
| From: root < | From: root < | ||
| To: Miquel.Cabanas@uab.cat | To: Miquel.Cabanas@uab.cat | ||
| Line 161: | Line 179: | ||
| Time slots have been allocated for weekly maintenance tasks | Time slots have been allocated for weekly maintenance tasks | ||
| on all SeRMN spectrometers for week 52/2013 starting: | on all SeRMN spectrometers for week 52/2013 starting: | ||
| - | Thu 2013/12/26. | + | Mon 2013/12/23. |
| </ | </ | ||
| Line 168: | Line 186: | ||
| < | < | ||
| -------- Original Message -------- | -------- Original Message -------- | ||
| - | Subject: | + | Subject: SeRMN Booking System - NMR Routine reservations |
| - | Date: Fri, 18 Oct 2013 11:09:27 +0200 | + | Date: Sun, 27 Oct 2013 16:54:46 +0300 |
| - | From: | + | From: root < |
| - | To: | + | To: Miquel.Cabanas@uab.cat |
| AUTOMATED EMAIL MESSAGE. DO NOT REPLY | AUTOMATED EMAIL MESSAGE. DO NOT REPLY | ||
| Line 178: | Line 196: | ||
| Failed to allocate time slots for weekly maintenance tasks | Failed to allocate time slots for weekly maintenance tasks | ||
| - | week $mon_weekno | + | week 52/ |
| Please, report this issue to the system administrator. | Please, report this issue to the system administrator. | ||
| </ | </ | ||
| + | |||
| + | ===== Entrada al registre crontab ===== | ||
| + | |||
| + | Aquesta és l' | ||
| + | |||
| + | < | ||
| + | # Bumblebee 1.1.4 - Automated bookings for weekly maintenance tasks. It runs | ||
| + | # on Sunday at 03:00. | ||
| + | # | ||
| + | 0 | ||
| + | </ | ||
| + | |||
| ===== Seguretat ===== | ===== Seguretat ===== | ||
| Per motius de seguretat (el programet conté el nom d' | Per motius de seguretat (el programet conté el nom d' | ||
| - | * permisos: | + | * permisos |
| + | * permisos fitxer '' | ||
| * propietari (user: | * propietari (user: | ||
| Line 197: | Line 228: | ||
| + | ===== Recreació de les reserves antigues ===== | ||
| + | Aquest canvi a l' | ||
| + | |||
| + | <code bash create_past_maintenance_bookings.sh> | ||
| + | #!/bin/bash | ||
| + | # | ||
| + | # create_past_maintenance_bookings.sh | ||
| + | # | ||
| + | # (c) 2013, Miquel Cabanas, SeRMN, UAB | ||
| + | # | ||
| + | # Started writing: | ||
| + | # Last updated: | ||
| + | # | ||
| + | # This script runs the MySql commands needed to create the maintenance | ||
| + | # bookings needed to replace the past maintenance periods that were set | ||
| + | # in the spectrometer schedules and have been replaced now by real bookings. | ||
| + | # | ||
| + | |||
| + | # programs | ||
| + | |||
| + | date=`which date` | ||
| + | mail=`which mail` | ||
| + | mysql=`which mysql` | ||
| + | |||
| + | # Bumblebee booking system database where everything gets stored | ||
| + | |||
| + | myuser=' | ||
| + | mypass=' | ||
| + | mydb=' | ||
| + | |||
| + | # First Wednesday on a particular year | ||
| + | |||
| + | firstwed=`$date +%F -d " | ||
| + | echo "First wednesday (included): $firstwed" | ||
| + | |||
| + | # Last Wednesday on a particular year | ||
| + | |||
| + | lastwed=`$date +%F -d " | ||
| + | echo "Last wednesday (excluded): $lastwed" | ||
| + | |||
| + | # insert booking entries in the database | ||
| + | |||
| + | wed=$firstwed | ||
| + | |||
| + | while [[ " | ||
| + | |||
| + | echo " | ||
| + | |||
| + | $mysql --database=$mydb --user=$myuser --password=$mypass << EOF | ||
| + | /* begin transaction */ | ||
| + | BEGIN; | ||
| + | /* Insert bookings for weekly maintenance tasks in all vertical magnets. */ | ||
| + | /* By default, book Wednesday morning from 09:00 to 13:00, 8 weeks in advance | ||
| + | |||
| + | /* Avance DPX-250-QNP (250-AUTO) - Wednesday from 09:00 to 13:00 -> 4 hours */ | ||
| + | INSERT INTO bookings(bookwhen, | ||
| + | |||
| + | /* Avance DPX-250-BACS (250-ROBOT) - Wednesday from 09:00 to 13:00 -> 4 hours */ | ||
| + | INSERT INTO bookings(bookwhen, | ||
| + | |||
| + | /* Avance DPX-360 - Wednesday from 09:00 to 13:00 -> 4 hours */ | ||
| + | INSERT INTO bookings(bookwhen, | ||
| + | |||
| + | /* AvanceIII 400SB - Wednesday from 09:00 to 13:00 -> 4 hours */ | ||
| + | INSERT INTO bookings(bookwhen, | ||
| + | |||
| + | /* AvanceII 400WB - Wednesday from 09:00 to 13:00 -> 4 hours */ | ||
| + | INSERT INTO bookings(bookwhen, | ||
| + | |||
| + | /* Avance DRX-500 - Wednesday from 09:00 to 13:00 -> 4 hours */ | ||
| + | INSERT INTO bookings(bookwhen, | ||
| + | |||
| + | /* AvanceII+ 600 - Wednesday from 09:00 to 13:00 -> 4 hours */ | ||
| + | INSERT INTO bookings(bookwhen, | ||
| + | |||
| + | /* Hypersense DNP - Wednesday from 09:00 to 13:00 -> 4 hours */ | ||
| + | INSERT INTO bookings(bookwhen, | ||
| + | |||
| + | /* commit transaction */ | ||
| + | COMMIT; | ||
| + | EOF | ||
| + | |||
| + | wed=`$date +%F -d "$wed + 1 week"` | ||
| + | |||
| + | done | ||
| + | |||
| + | exit | ||
| + | </ | ||