mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-29 13:12:36 +00:00
bashbot 0.5 Release Candidate
This commit is contained in:
parent
0c144bcac2
commit
050d376f28
@ -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!
|
||||
|
||||
#### $$VERSION$$ v0.49-4-g8e08c1f
|
||||
#### $$VERSION$$ v0.5-rc-0-g0c144bc
|
||||
|
@ -7,7 +7,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.49-4-g8e08c1f
|
||||
#### $$VERSION$$ v0.5-rc-0-g0c144bc
|
||||
|
||||
|
||||
SHELL=/bin/sh
|
||||
@ -28,9 +28,9 @@ MAILTO=root
|
||||
# * * * * * root echo "run every minute!"
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# description: Start or stop telegram-bash-bot
|
||||
#
|
||||
#### $$VERSION$$ v0.49-4-g8e08c1f
|
||||
#### $$VERSION$$ v0.5-rc-0-g0c144bc
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: bashbot
|
||||
|
25
bashbot.sh
25
bashbot.sh
@ -10,15 +10,10 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.49-9-gb27017f
|
||||
|
||||
# get location of bashbot.sh an change to bashbot dir
|
||||
SCRIPT="./$(basename $0)"
|
||||
SCRIPTDIR="$(dirname $0)"
|
||||
cd "${SCRIPTDIR}"
|
||||
#### $$VERSION$$ v0.5-rc-0-g0c144bc
|
||||
|
||||
# are we runnig in a terminal?
|
||||
if [ -t 1 ] || [ "$TERM" != "" ]; then
|
||||
if [ -t 1 ] && [ "$TERM" != "" ]; then
|
||||
CLEAR='clear'
|
||||
RED='\e[31m'
|
||||
GREEN='\e[32m'
|
||||
@ -26,6 +21,10 @@ if [ -t 1 ] || [ "$TERM" != "" ]; then
|
||||
NC='\e[0m'
|
||||
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
|
||||
echo -e "${ORANGE}WARNING: $SCRIPTDIR is not writeable!${NC}"
|
||||
@ -61,7 +60,7 @@ if [ ! -f "$COUNT" ]; then
|
||||
touch "$COUNT"
|
||||
elif [ ! -w "$COUNT" ]; then
|
||||
$CLEAR
|
||||
echo -e "${RED}ERROR: can't write to $COUNT!.${NC}"
|
||||
echo -e "${RED}ERROR: Can't write to $COUNT!.${NC}"
|
||||
ls -l "$COUNT"
|
||||
exit 1
|
||||
fi
|
||||
@ -550,7 +549,7 @@ case "$1" in
|
||||
echo -e "${RED}User \"$TOUSER\" not found!${NC}"
|
||||
exit 2
|
||||
else
|
||||
echo "Ajusting user in bashbot.rc ..."
|
||||
echo "Adjusting user in bashbot.rc ..."
|
||||
sed -i '/^[# ]*runas=/ s/runas=.*$/runas="'$TOUSER'"/' bashbot.rc
|
||||
echo "Adjusting Owner and Permissions ..."
|
||||
chown -R "$TOUSER" . *
|
||||
@ -565,7 +564,7 @@ case "$1" in
|
||||
"background" | "resumeback")
|
||||
$CLEAR
|
||||
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
|
||||
echo -e "${RED}No background processes to start.${NC}"; break
|
||||
else
|
||||
@ -578,8 +577,8 @@ case "$1" in
|
||||
echo "restartbackground ${PROG} ${fifo}"
|
||||
( tmux kill-session -t "${fifo}"; tmux kill-session -t sendprocess_${fifo}; rm -f -r $TMPDIR/${fifo}) 2>/dev/null
|
||||
mkfifo "$TMPDIR/${fifo}"
|
||||
TMUX= tmux new-session -d -s "${fifo}" "${PROGi}" &>"$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 "${fifo}" "${PROG} &>$TMPDIR/${fifo}; echo imprettydarnsuredatdisisdaendofdacmd>$TMPDIR/${fifo}"
|
||||
TMUX= tmux new-session -d -s sendprocess_${fifo} "bash $SCRIPT outproc ${CHAT[ID]} ${fifo}"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
@ -592,7 +591,7 @@ case "$1" in
|
||||
"killback" | "suspendback")
|
||||
$CLEAR
|
||||
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
|
||||
echo -e "${RED}No background processes.${NC}"; break
|
||||
else
|
||||
|
@ -4,7 +4,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# 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.
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
2
notify
2
notify
@ -2,7 +2,7 @@
|
||||
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# 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
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
2
question
2
question
@ -3,7 +3,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# 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
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
Loading…
Reference in New Issue
Block a user