Fix send_message function and restorecon path

This commit is contained in:
adrien 2022-11-23 10:18:37 +01:00
parent a9e0aeab6d
commit aacc7f2ede
Signed by: adrien
GPG Key ID: 4F17BEA67707AC21

View File

@ -15,20 +15,19 @@ set -o nounset
# Don't hide errors within pipes # Don't hide errors within pipes
set -o pipefail set -o pipefail
# Set your API key here # set your API key here
key= key=
# Set your chat id here # set your chat id here
chat_id= chat_id=
function send_message() { function send_message() {
if ! [ $# -eq 0 ]; then if ! [ $# -eq 0 ]; then
curl --silent --show-error --fail --request POST "https://api.telegram.org/$key/sendMessage" --data chat_id="$chat_id" --data text="$1" --output /dev/null curl --silent --show-error --fail --request POST "https://api.telegram.org/$key/sendMessage" --data chat_id="$chat_id" --data text="$1" --output /dev/null
exit else
echo "No argument supplied, please specify the message to send"
exit 1
fi fi
echo "No argument supplied, please specify the message to send"
exit 1
} }
function update_gitea() { function update_gitea() {
@ -39,8 +38,8 @@ function update_gitea() {
# Set the correct permissions # Set the correct permissions
chmod +x /usr/local/bin/gitea chmod +x /usr/local/bin/gitea
restorecon /usr/local/bin/gitea /sbin/restorecon -v /usr/local/bin/gitea
restorecon /var/lib/gitea/log/gitea.log /sbin/restorecon -v /var/lib/gitea/log/gitea.log
if ! systemctl start gitea.service; then if ! systemctl start gitea.service; then
send_message "[Gitea] - Gitea service did not start correctly. Please log in as soon as possible and see what went wrong" send_message "[Gitea] - Gitea service did not start correctly. Please log in as soon as possible and see what went wrong"