From 87a95b9d7665b244a08a66722f9f7d124ebd13e1 Mon Sep 17 00:00:00 2001 From: Yigid BALABAN Date: Wed, 18 Sep 2024 00:59:57 +0300 Subject: [PATCH] moar stuff --- README.md | 26 ++++++++++++++++++++++++++ install.sh | 7 +++++++ login-mailer.service | 7 +++++++ login mailer.sh => login-mailer.sh | 0 login-mailer.timer | 11 +++++++++++ uninstall.sh | 14 ++++++++++++++ 6 files changed, 65 insertions(+) create mode 100644 README.md create mode 100644 install.sh create mode 100644 login-mailer.service rename login mailer.sh => login-mailer.sh (100%) create mode 100644 login-mailer.timer create mode 100644 uninstall.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..8e091c2 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# server-toolset + +## login mailer.sh + +Get an email when someone logs in on your server. + +Requires you to host/use an email proxy. See [git.fybx.dev/fyb/mail-proxy](https://git.fybx.dev/fyb/mail-proxy) for a simple Express.js and nodemailer powered alternative. Fork and deploy to Vercel, it's set! + +`install.sh` and `uninstall.sh` provided for ease-of-use, places systemctl service and timer, and enables it. + +## credits + +Feel free to contact me for collaboration on anything! + +Yiğid BALABAN, <[fyb@fybx.dev][llmail]> + +[My Website][llwebsite] • [My Bento][llbento] • [X][llx] • [LinkedIn][lllinkedin] + +2024 + +[llmail]: mailto:fyb@fybx.dev +[llwebsite]: https://fybx.dev +[llbento]: https://bento.me/balaban +[llx]: https://x.com/fybalaban +[lllinkedin]: https://linkedin.com/in/fybx + diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..8b418db --- /dev/null +++ b/install.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cp ./login-mailer.service /etc/systemd/system/login-mailer.service +cp ./login-mailer.timer /etc/systemd/system/login-mailer.timer +systemctl daemon-reload +systemctl enable --now login-mailer.timer +systemctl status login-mailer.timer diff --git a/login-mailer.service b/login-mailer.service new file mode 100644 index 0000000..87dfa98 --- /dev/null +++ b/login-mailer.service @@ -0,0 +1,7 @@ +[Unit] +Description=Login Mailer + +[Service] +Type=simple +ExecStart=/root/server-toolset/login-mailer.sh + diff --git a/login mailer.sh b/login-mailer.sh similarity index 100% rename from login mailer.sh rename to login-mailer.sh diff --git a/login-mailer.timer b/login-mailer.timer new file mode 100644 index 0000000..11f90d7 --- /dev/null +++ b/login-mailer.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Chore Login Mailer + +[Timer] +OnBootSec=1min +OnUnitActiveSec=1s +Unit=login-mailer.service + +[Install] +WantedBy=timers.target + diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..f8b26b8 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +systemctl stop login-mailer.timer +systemctl disable login-mailer.timer + +if [ -f /etc/systemd/system/login-mailer.service ]; then + rm /etc/systemd/system/login-mailer.service +fi + +if [ -f /etc/systemd/system/login-mailer.timer ]; then + rm /etc/systemd/system/login-mailer.timer +fi + +systemctl daemon-reload