Update README

This commit is contained in:
Robin Meier 2024-03-16 01:28:11 +01:00
parent cee105b338
commit 9fcfbb09af
1 changed files with 23 additions and 9 deletions

View File

@ -8,21 +8,35 @@ The covered tasks range from file change tracking via http/ssh monitoring to zfs
The scripts in this repo ***must*** be checked out into `/root/scripts`.
```shell
```bash
cd /root
git clone ssh://git@git.mneun.ch:2222/radioelephant/admin-scripts.git scripts
mkdir -p /root/logs
```
## Config Files
If you are unable to clone via ssh, try via https.
```bash
cd /root
git clone https://git.mneun.ch/radioelephant/admin-scripts.git scripts
mkdir -p /root/logs
```
### Config Files
For each script there is a `.script_name_env.EXAMPLE` file, which you must copy (remove `.EXAMPLE` part) and edit while providing your own information.
```bash
SCRIPT_NAME=zfs_health_check
cp /root/scripts/.${SCRIPT_NAME}_env.EXAMPLE /root/scripts/.${SCRIPT_NAME}_env
vim /root/scripts/.${SCRIPT_NAME}_env
```
If you want to use the example configuration, you can symbolic link the files.
This really only makes sense for `.system_health_check`.
The command for this is:
```shell
```bash
cd /root/scripts
ln -s .system_health_check.EXAMPLE .system_health_check
```
@ -32,7 +46,7 @@ ln -s .system_health_check.EXAMPLE .system_health_check
To be notified immediately before sever shutdown the contained `run-before-shutdown.service` can be installed as follows.
This service file will send a telegram notification informing about the pending shutdown.
```shell
```bash
ln -s /root/scripts/run-before-shutdown.service /etc/systemd/system/shutdown.target.wants/run-before-shutdown.service
systemctl daemon-reload
```
@ -41,7 +55,7 @@ systemctl daemon-reload
To install the startup helper script into the regular user home use the following commands, while supplying your username on the first line.
```shell
```bash
USRNAME=radioelephant
ln -s /root/scripts/post_startup.sh /home/$USRNAME/post_startup
cp /root/scripts/.post_startup_env.EXAMPLE /home/$USRNAME/.post_startup_env
@ -54,7 +68,7 @@ vim /home/$USRNAME/.post_startup_env
You can update the admin scripts by pulling from the git remote.
```shell
```bash
cd /root/scripts
git pull
```
@ -78,7 +92,7 @@ If you are unsure about the cron schedule, use [Crontab Guru](https://crontab.gu
My current crontab looks like this:
```cron
```crontab
* * * * * bash -c '/root/scripts/file_monitor.sh | /root/scripts/telegram_notification.sh'
*/2 * * * * bash -c '/root/scripts/monitoring.sh | /root/scripts/telegram_notification.sh'
*/4 * * * * bash -c '/root/scripts/dyndns.sh | /root/scripts/telegram_notification.sh'
@ -92,7 +106,7 @@ My current crontab looks like this:
Adapt this to your needs, you might also implement other checks and only use the `telegram_notification.sh` script from this repo.
Or you might implement your own notification script to notify you via another service.
The `telegram_notification.sh` can easily be adapted to forward all notifications to `STDOUT` which typically sends an email.
The `telegram_notification.sh` can easily be adapted (just remove comment) to forward all notifications to `STDOUT` which typically makes cron send a mail.
### Startup
@ -103,7 +117,7 @@ Because my containers struggle with DNS which depends on a docker container itse
To complete the post startup tasks use the following command after logging in as your regular user:
```shell
```bash
./post_startup.sh
```