2016-12-09 16:08:26 +01:00
# ipr_scripts
2016-10-26 14:59:05 +02:00
2016-12-09 16:08:26 +01:00
#### Table of Contents
1. [Overview ](#overview )
2. [Scripts ](#scripts )
* [Proxmox ](#proxmox )
* [Grav ](#grav )
2017-01-17 18:27:37 +01:00
* [Sesame2mail ](#sesame2mail )
2017-02-15 12:16:46 +01:00
* [WordPress ](#wordpress )
2016-12-09 16:08:26 +01:00
## Overview
Some usefull scripts for admin or users.
## Scripts
### Proxmox
2018-02-13 13:58:04 +01:00
#### proxmox.template.debian.sh
Some commands in order to clean and prepare a container to become a template.
1. The script will :
* Allow root's connection to SSH with password.
* Reconfigure timezone to **Europe/Paris** .
* Reconfigure locales to **en_US.UTF-8** .
* Download an additionnal script use by our preseed with PXE to configure logs (rsyslog, logrotate,…).
* Remove **x11** useless packages.
* Clean some stuff (downloaded packages, empty logs,…).
2. How-to use :
``` sh
wget https://git.ipr.univ-rennes1.fr/cellinfo/scripts/raw/master/proxmox/proxmox.template.debian.sh -O /tmp/proxmox.template.debian.sh
chmod +x /tmp/proxmox.template.debian.sh
/tmp/proxmox.template.debian.sh
```
#### vzdump-hook-lxc-stretch-template.pl
2016-12-09 16:08:26 +01:00
This script must be used as a vzdump's hook (the backup utility for CT and VMs for Proxmox).
1. The script will :
* Copy the current dump as a template in ** /mnt/zfsbkp/template/cache** (by default).
2018-02-13 13:58:04 +01:00
* Unlink ** $TEMPLATE_FILE_LINK**.
* Link ** $TEMPLATE_FILE_LINK** to the last dump in order to have a better name.
* Remove the templates oldest than 2 days (by default).
2016-12-09 16:08:26 +01:00
2. How-to use :
* Define a backup as usual (in the Proxmox's webgui) and prefer to select only one container.
2018-02-13 13:58:04 +01:00
* In command on the hypervisor, open ** /etc/pve/vzdump.cron** and edit the line of the new dump to add : ** --script /usr/local/bin/vzdump-hook-lxc-stretch-template.pl**.
2016-12-09 16:08:26 +01:00
3. Customization :
* If you don't store template in the default path (**/mnt/zfsbkp/template/cache**), please edit the variable ** $TEMPLATE_DIR** in the script.
2018-02-13 13:58:04 +01:00
* You might want to set another template name, please edit the variable ** $TEMPLATE_FILE_LINK** in the script.
#### vzdump-hook-lxc-jessie-template.pl
Same as above but set jessie in ** $TEMPLATE_FILE_LINK**.
2016-12-09 16:08:26 +01:00
### Grav
#### grav_cron
A daily cron to check if [Grav][grav website] got available updates.
2016-10-26 14:59:05 +02:00
* It need to work from the Grav's root directory.
2016-12-09 16:08:26 +01:00
* If an update is available, it will create a empty file (${GRAV_ROOT}/logs/update), else it will ensure the "update" file is removed.
* Be sure to monitore if ** ${GRAV_ROOT}/logs/update** exist.
2016-10-26 14:59:05 +02:00
[grav website]: https://getgrav.org/
2017-01-17 18:27:37 +01:00
### Sesame2mail
Give a user's mail address from it's user ID (sesame).
The first argument can be :
* A file with a list of user ID (sesame), one per line.
* A user ID (sesame), only one.
2017-02-15 12:16:46 +01:00
### WordPress
#### wordpress_cron
2017-02-15 15:02:03 +01:00
A daily cron to check [WordPress][wordpress website]'s Core and plugins updates.
2017-02-15 12:16:46 +01:00
* It need [**wp-cli**][wp-cli website] tool.
2017-02-15 15:02:03 +01:00
* If an update is available, it will create a empty file (${WP_ROOT}/.update_core or ${WP_ROOT}/.update_plugin), else it will ensure the "update" files are absents.
* So, be sure to monitore if the files ** ${WP_ROOT}/.update_*** exists !
2017-02-15 12:16:46 +01:00
[wordpress website]: https://wordpress.org/
[wp-clie website]: https://make.wordpress.org/cli/handbook/installing/