forked from vern/scripts
17 lines
640 B
Bash
Executable File
17 lines
640 B
Bash
Executable File
#!/usr/bin/env -S bash -e
|
|
[[ -z "$1" ]] && {
|
|
printf "Usage: %s message [description]\n" "$0"
|
|
exit 1
|
|
}
|
|
|
|
RSS=/var/log/announcements.xml
|
|
DATE="$(date --rfc-email -u)"
|
|
|
|
MSG='\n\t<item>\n\t\t<title>'"$1"'<\/title>\n\t\t<description>'"$2"'<\/description>\n\t\t<author>root@vern.cc<\/author>\n\t\t<link>https:\/\/vern.cc\/announcements<\/link>\n\t\t<pubDate>'"$DATE"'<\/pubDate>\n\t<\/item>'
|
|
|
|
[[ -z "$2" ]] && {
|
|
MSG='\n\t<item>\n\t\t<title>'"$1"'<\/title>\n\t\t<author>root@vern.cc<\/author>\n\t\t<link>https:\/\/vern.cc\/announcements<\/link>\n\t\t<pubDate>'"$DATE"'<\/pubDate>\n\t<\/item>'
|
|
}
|
|
|
|
sed -i "s/<\/webMaster>/<\/webMaster>$MSG/" $RSS
|