feat: announcement
This commit is contained in:
parent
ecd5b757a4
commit
dafa4f59ec
1 changed files with 8 additions and 2 deletions
|
|
@ -95,13 +95,19 @@ in {
|
||||||
description = "Minecraft Server Announcement";
|
description = "Minecraft Server Announcement";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = ''mcrcon -H localhost -P 25566 -p "whatisloveohbabydonthurtmedonthurtmenomore" '/title @a title {"text":"This server runs on NixOS","color":"blue","bold":true}'';
|
ExecStart = ''
|
||||||
};
|
for i in {1..5}; do
|
||||||
|
mcrcon -H localhost -P 25566 -p "whatisloveohbabydonthurtmedonthurtmenomore" '/title @a title {"text":"This server runs on NixOS","color":"blue","bold":true}';
|
||||||
|
sleep 1; # Wait 2 seconds between announcements
|
||||||
|
done
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.timers.mc-announcement = {
|
systemd.timers.mc-announcement = {
|
||||||
description = "Run Minecraft Announcement every hour";
|
description = "Run Minecraft Announcement every hour";
|
||||||
|
enable = true;
|
||||||
wantedBy = ["timers.target"];
|
wantedBy = ["timers.target"];
|
||||||
|
after = ["mc-aged.service"];
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
OnCalendar = "hourly"; # Change this as needed
|
OnCalendar = "hourly"; # Change this as needed
|
||||||
Persistent = true;
|
Persistent = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue