bashbot 0.5 Release Candidate

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-03-31 12:12:55 +02:00
parent 0c144bcac2
commit 050d376f28
8 changed files with 21 additions and 22 deletions

View File

@ -445,4 +445,4 @@ No - its not more or less insecure as any other Bot written in any other languag
If you feel that there's something missing or if you found a bug, feel free to submit a pull request! If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
#### $$VERSION$$ v0.49-4-g8e08c1f #### $$VERSION$$ v0.5-rc-0-g0c144bc

View File

@ -7,7 +7,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# #
#### $$VERSION$$ v0.49-4-g8e08c1f #### $$VERSION$$ v0.5-rc-0-g0c144bc
SHELL=/bin/sh SHELL=/bin/sh
@ -28,9 +28,9 @@ MAILTO=root
# * * * * * root echo "run every minute!" # * * * * * root echo "run every minute!"
# run as www every day at 0:00 # run as www every day at 0:00
0 0 * * * nobody /usr/local/telegram-bot-bash/bashbot.sh start # (re)start bot 0 0 * * * nobody /usr/local/telegram-bot-bash/bashbot.sh start # (re)start bot
0 0 * * * nobody /usr/local/telegram-bot-bash/bashbot.sh resumeback # (re)start background jobs 0 0 * * * nobody /usr/local/telegram-bot-bash/bashbot.sh resumeback # (re)start background jobs
# run as www on 24 of Dec, 12:00 # run as www on 24 of Dec, 12:00
0 12 24 12 * nobody /usr/local/telegram-bot-bash/bashbot.sh broadcast "X-Mas shopping is over!" # broadcast qa message 0 12 24 12 * nobody /usr/local/telegram-bot-bash/bashbot.sh broadcast "X-Mas shopping is over!" # broadcast a message

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# description: Start or stop telegram-bash-bot # description: Start or stop telegram-bash-bot
# #
#### $$VERSION$$ v0.49-4-g8e08c1f #### $$VERSION$$ v0.5-rc-0-g0c144bc
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: bashbot # Provides: bashbot

View File

@ -10,15 +10,10 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# #
#### $$VERSION$$ v0.49-9-gb27017f #### $$VERSION$$ v0.5-rc-0-g0c144bc
# get location of bashbot.sh an change to bashbot dir
SCRIPT="./$(basename $0)"
SCRIPTDIR="$(dirname $0)"
cd "${SCRIPTDIR}"
# are we runnig in a terminal? # are we runnig in a terminal?
if [ -t 1 ] || [ "$TERM" != "" ]; then if [ -t 1 ] && [ "$TERM" != "" ]; then
CLEAR='clear' CLEAR='clear'
RED='\e[31m' RED='\e[31m'
GREEN='\e[32m' GREEN='\e[32m'
@ -26,6 +21,10 @@ if [ -t 1 ] || [ "$TERM" != "" ]; then
NC='\e[0m' NC='\e[0m'
fi fi
# get location of bashbot.sh an change to bashbot dir
SCRIPT="./$(basename $0)"
SCRIPTDIR="$(dirname $0)"
cd "${SCRIPTDIR}" || echo -e "${RED}ERROR: Can't change to ${SCRIPTDIR} ...${NC}" && exit 1
if [ ! -w "." ]; then if [ ! -w "." ]; then
echo -e "${ORANGE}WARNING: $SCRIPTDIR is not writeable!${NC}" echo -e "${ORANGE}WARNING: $SCRIPTDIR is not writeable!${NC}"
@ -61,7 +60,7 @@ if [ ! -f "$COUNT" ]; then
touch "$COUNT" touch "$COUNT"
elif [ ! -w "$COUNT" ]; then elif [ ! -w "$COUNT" ]; then
$CLEAR $CLEAR
echo -e "${RED}ERROR: can't write to $COUNT!.${NC}" echo -e "${RED}ERROR: Can't write to $COUNT!.${NC}"
ls -l "$COUNT" ls -l "$COUNT"
exit 1 exit 1
fi fi
@ -550,7 +549,7 @@ case "$1" in
echo -e "${RED}User \"$TOUSER\" not found!${NC}" echo -e "${RED}User \"$TOUSER\" not found!${NC}"
exit 2 exit 2
else else
echo "Ajusting user in bashbot.rc ..." echo "Adjusting user in bashbot.rc ..."
sed -i '/^[# ]*runas=/ s/runas=.*$/runas="'$TOUSER'"/' bashbot.rc sed -i '/^[# ]*runas=/ s/runas=.*$/runas="'$TOUSER'"/' bashbot.rc
echo "Adjusting Owner and Permissions ..." echo "Adjusting Owner and Permissions ..."
chown -R "$TOUSER" . * chown -R "$TOUSER" . *
@ -565,7 +564,7 @@ case "$1" in
"background" | "resumeback") "background" | "resumeback")
$CLEAR $CLEAR
echo -e "${GREEN}Restart background processes ...${NC}" echo -e "${GREEN}Restart background processes ...${NC}"
for FILE in "${TMPDIR}/*-back.cmd"; do for FILE in "${TMPDIR}/"*-back.cmd; do
if [ "$FILE" == "${TMPDIR}/*-back.cmd" ]; then if [ "$FILE" == "${TMPDIR}/*-back.cmd" ]; then
echo -e "${RED}No background processes to start.${NC}"; break echo -e "${RED}No background processes to start.${NC}"; break
else else
@ -578,8 +577,8 @@ case "$1" in
echo "restartbackground ${PROG} ${fifo}" echo "restartbackground ${PROG} ${fifo}"
( tmux kill-session -t "${fifo}"; tmux kill-session -t sendprocess_${fifo}; rm -f -r $TMPDIR/${fifo}) 2>/dev/null ( tmux kill-session -t "${fifo}"; tmux kill-session -t sendprocess_${fifo}; rm -f -r $TMPDIR/${fifo}) 2>/dev/null
mkfifo "$TMPDIR/${fifo}" mkfifo "$TMPDIR/${fifo}"
TMUX= tmux new-session -d -s "${fifo}" "${PROGi}" &>"$TMPDIR/${fifo}"; echo "imprettydarnsuredatdisisdaendofdacmd" >"$TMPDIR/${fifo}" TMUX= tmux new-session -d -s "${fifo}" "${PROG} &>$TMPDIR/${fifo}; echo imprettydarnsuredatdisisdaendofdacmd>$TMPDIR/${fifo}"
TMUX= tmux new-session -d -s "sendprocess_${fifo}" "bash $SCRIPT outproc ${CHAT[ID]} ${fifo}" TMUX= tmux new-session -d -s sendprocess_${fifo} "bash $SCRIPT outproc ${CHAT[ID]} ${fifo}"
fi fi
done done
;; ;;
@ -592,7 +591,7 @@ case "$1" in
"killback" | "suspendback") "killback" | "suspendback")
$CLEAR $CLEAR
echo -e "${GREEN}Stopping background processes ...${NC}" echo -e "${GREEN}Stopping background processes ...${NC}"
for FILE in "${TMPDIR}/*-back.cmd"; do for FILE in "${TMPDIR}/"*-back.cmd; do
if [ "$FILE" == "${TMPDIR}/*-back.cmd" ]; then if [ "$FILE" == "${TMPDIR}/*-back.cmd" ]; then
echo -e "${RED}No background processes.${NC}"; break echo -e "${RED}No background processes.${NC}"; break
else else

View File

@ -4,7 +4,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# #
#### $$VERSION$$ v0.49-4-g8e08c1f #### $$VERSION$$ v0.5-rc-0-g0c144bc
# adjust your language setting here, e.g.when run from other user or cron. # adjust your language setting here, e.g.when run from other user or cron.
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment # https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment

2
notify
View File

@ -2,7 +2,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#### $$VERSION$$ v0.49-4-g8e08c1f #### $$VERSION$$ v0.5-rc-0-g0c144bc
# adjust your language setting here # adjust your language setting here
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment # https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment

View File

@ -3,7 +3,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#### $$VERSION$$ v0.49-4-g8e08c1f #### $$VERSION$$ v0.5-rc-0-g0c144bc
# adjust your language setting here # adjust your language setting here
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment # https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
#### $$VERSION$$ v0.49-4-g8e08c1f #### $$VERSION$$ v0.5-rc-0-g0c144bc
# #
# Easy Versioning in git: # Easy Versioning in git:
# #