diff --git a/.gitignore b/.gitignore index 90dfe7d..b9f89cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .*_env +.last_changelog_read + storage/ # This file is unused atm diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ccc2115 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Admin Scripts + +## Changelog + +### 2024-03-16 - Initial Version diff --git a/README.md b/README.md index 655a79d..4fd5313 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ This repo contains some administration scripts for administrering a debian machine. The covered tasks range from file change tracking via http/ssh monitoring to zfs health checking. +*TODO: Add better description about host system and notification method in first sentence.* + ## Installation @@ -22,6 +24,9 @@ git clone https://git.mneun.ch/radioelephant/admin-scripts.git scripts mkdir -p /root/logs ``` +Please also quickly read the [CHANGELOG](CHANGELOG.md) and confirm this by running `date > /root/scripts/.last_changelog_read`. +This will be helpful when updating the admin scripts. + ### 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. @@ -32,7 +37,7 @@ 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. +If you want to use the example configuration, you could symbolic link the files instead of just copying them. This really only makes sense for `.system_health_check`. The command for this is: @@ -57,13 +62,17 @@ To install the startup helper script into the regular user home use the followin ```bash USRNAME=radioelephant -ln -s /root/scripts/post_startup.sh /home/$USRNAME/post_startup +cp /root/scripts/post_startup.sh /home/$USRNAME/post_startup.sh cp /root/scripts/.post_startup_env.EXAMPLE /home/$USRNAME/.post_startup_env +chown $USRNAME:$USRNAME /home/$USRNAME/post_startup.sh +chown $USRNAME:$USRNAME /home/$USRNAME/.post_startup_env vim /home/$USRNAME/.post_startup_env ``` *Just shutdown your computer if you don't know how to exit VIM at this point.* +See also [Updating Startup Helper](#updating-startup-helper). + ### Updating You can update the admin scripts by pulling from the git remote. @@ -73,6 +82,40 @@ cd /root/scripts git pull ``` +For most of the scripts you only need to check if the `.[script_name]_env.EXAMPLE` has changed and contains different keys than your copied `.[script_name]_env` file. +For your convenience, changes to environment variable files will be documented in the [CHANGELOG](CHANGELOG.md). +If you followed the instructions in this README, then you will find the last time you updated this repository in the `.last_changelog_read` file. +Read it with `cat /root/scripts/.last_changelog_read`. + +**Make sure to update the last reading time file after reading the CHANGELOG with `date > /root/scripts/.last_changelog_read`** + +#### Updating Startup Helper + +The startup helper script in the regular user home cannot be updated via `git pull` and needs to be compared and/or copied manually. +To compare use the following commands: + +```bash +USRNAME=radioelephant +diff /root/scripts/post_startup.sh /home/$USRNAME/post_startup.sh +diff /root/scripts/.post_startup_env.EXAMPLE /home/$USRNAME/.post_startup_env +``` + +To copy the startup helper script again, use the following commands (first line not needed, if you just ran the last set of commands). +Please adapt the environment file `/home/[USRNAME]/.post_startup_env` manually. + +```bash +USRNAME=radioelephant +cp /root/scripts/post_startup.sh /home/$USRNAME/post_startup.sh +chown $USRNAME:$USRNAME /home/$USRNAME/post_startup.sh +``` + +**Make sure to update the last reading time file after reading the CHANGELOG with `date > /root/scripts/.last_changelog_read`** + +#### Updating Shutdown Service + +You might need to run `systemctl deamon-reload` after updating this repository. +This will be noted in the CHANGELOG for your convenience. + ## Usage