this is horrible
This commit is contained in:
commit
856edc1869
|
@ -0,0 +1,10 @@
|
||||||
|
#cron but worse
|
||||||
|
|
||||||
|
## how to use
|
||||||
|
basically just put it in your home folder and change scripts/paths and stuff
|
||||||
|
|
||||||
|
## how make systemd shits work ?
|
||||||
|
change exec path to where yuo put script duh
|
||||||
|
|
||||||
|
## what it do ?
|
||||||
|
basically just checks if a certain time in HH:MM format is every 60 seconds and if time matches with what is defined in cron-but-worse.xml it will execute what is in the script tag
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Path to the XML file
|
||||||
|
xml_file="./cron-but-worse.xml"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
# Extract the desired times, descriptions, and scripts from the XML file
|
||||||
|
times=($(grep -oP '<time>\K[^<]+' "$xml_file"))
|
||||||
|
descriptions=($(grep -oP '<description>\K[^<]+' "$xml_file"))
|
||||||
|
scripts=($(grep -oP '<script>\K[^<]+' "$xml_file"))
|
||||||
|
|
||||||
|
# Get the current time in HH:MM format
|
||||||
|
current_time=$(date +%H:%M)
|
||||||
|
|
||||||
|
for ((i=0; i<${#times[@]}; i++)); do
|
||||||
|
if [[ $current_time == "${times[i]}" ]]; then
|
||||||
|
echo "Executing command at $current_time: ${descriptions[i]}"
|
||||||
|
eval "${scripts[i]}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
sleep 60 # Sleep for 1 minute before checking again
|
||||||
|
done
|
|
@ -0,0 +1,18 @@
|
||||||
|
<commands>
|
||||||
|
<command>
|
||||||
|
<time>14:45</time>
|
||||||
|
<description>Play birb sounds for 10 Minutes</description>
|
||||||
|
<script>/home/sysadmin/vogel-sounds/vogel-10.sh</script>
|
||||||
|
</command>
|
||||||
|
<command>
|
||||||
|
<time>15:30</time>
|
||||||
|
<description>Play birb sounds for 10 Minutes</description>
|
||||||
|
<script>/home/sysadmin/vogel-sounds/vogel-10.sh</script>
|
||||||
|
</command>
|
||||||
|
<command>
|
||||||
|
<time>15:45</time>
|
||||||
|
<description>Play birb sounds for 10 Minutes</description>
|
||||||
|
<script>/home/sysadmin/vogel-sounds/vogel-10.sh</script>
|
||||||
|
</command>
|
||||||
|
</commands>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
aplay ./vogel-10.wav
|
Binary file not shown.
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=play birb sounds at certain times defined in an xml file
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/bash /home/sysadmin/vogel-sounds/cron-but-worse.sh
|
||||||
|
User=sysadmin
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Reference in New Issue