mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-29 05:02:46 +00:00
bashbot.rc: fix background start
This commit is contained in:
parent
7500ca0d12
commit
eb0c227615
12
bashbot.rc
12
bashbot.rc
@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# tested on: ubuntu, opensuse, debian
|
# tested on: ubuntu, opensuse, debian
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v1.45-dev-66-gec90ce8
|
#### $$VERSION$$ v1.45-dev-72-g7500ca0
|
||||||
# shellcheck disable=SC2009
|
# shellcheck disable=SC2009
|
||||||
# shellcheck disable=SC2181
|
# shellcheck disable=SC2181
|
||||||
# shellcheck disable=SC2250
|
# shellcheck disable=SC2250
|
||||||
@ -28,21 +28,21 @@ runcmd="echo Dry run:" # not activated until you edit lines below
|
|||||||
# Configuration Section
|
# Configuration Section
|
||||||
|
|
||||||
# edit the next line to fit the user you want to run bashbot, e.g. nobody:
|
# edit the next line to fit the user you want to run bashbot, e.g. nobody:
|
||||||
runas="nobody"
|
runas="www"
|
||||||
|
|
||||||
# uncomment one of the example lines to fit your system
|
# uncomment one of the example lines to fit your system
|
||||||
# runcmd="su ${runas} -s /bin/bash -c " # runasuser with *su*
|
# runcmd="su ${runas} -s /bin/bash -c " # runasuser with *su*
|
||||||
# runcmd="/usr/sbin/runuser ${runas} -s /bin/bash -c " # runasuser with *runuser*
|
runcmd="/usr/sbin/runuser ${runas} -s /bin/bash -c " # runasuser with *runuser*
|
||||||
|
|
||||||
# edit the values of the following lines to fit your config:
|
# edit the values of the following lines to fit your config:
|
||||||
# your bot name as given to botfather, e.g. mysomething_bot
|
# your bot name as given to botfather, e.g. mysomething_bot
|
||||||
name=""
|
name="GnadelTest_bot"
|
||||||
# your bot installation dir
|
# your bot installation dir
|
||||||
bashbotdir="/usr/local/github/telegram-bot-bash-develop/DIST/telegram-bot-bash"
|
bashbotdir="/usr/local/github/telegram-bot-bash-develop/DIST/telegram-bot-bash"
|
||||||
databotdir="${bashbotdir}/data-bot-bash"
|
databotdir="${bashbotdir}/data-bot-bash"
|
||||||
# programs to run
|
# programs to run
|
||||||
bashbot="cd ${bashbotdir}; ${bashbotdir}/bashbot.sh"
|
bashbot="cd ${bashbotdir}; ${bashbotdir}/bashbot.sh"
|
||||||
webhook="cd ${bashbotdir}; ${bashbotdir}/bin/process_batch.sh --startbot --watch ${databotdir}/webhook-fifo-${name} &"
|
webhook="cd ${bashbotdir}; nohup ${bashbotdir}/bin/process_batch.sh --startbot --watch ${databotdir}/webhook-fifo-${name}"
|
||||||
# set additionl parameter, e.g. debug
|
# set additionl parameter, e.g. debug
|
||||||
mode=""
|
mode=""
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ case "$1" in
|
|||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
'starthook')
|
'starthook')
|
||||||
$runcmd "nohup $webhook $mode &>>${bashbotdir}/logs/WEBHOOK.log" # >/dev/null 2>&1 </dev/null
|
$runcmd "$webhook $mode </dev/null &>>${bashbotdir}/logs/WEBHOOK.log &" # >/dev/null 2>&1 </dev/null
|
||||||
sleep 1
|
sleep 1
|
||||||
$0 status
|
$0 status
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
@ -21,7 +21,7 @@ USAGE='process_update.sh [-h|--help] [-s|--startbot] [-w|--watch] [-n|--lines n]
|
|||||||
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
|
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
|
||||||
# CREATED: 27.02.2021 13:14
|
# CREATED: 27.02.2021 13:14
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v1.45-dev-69-gb454827
|
#### $$VERSION$$ v1.45-dev-72-g7500ca0
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
####
|
####
|
||||||
@ -61,7 +61,7 @@ file="${WEBHOOK}"
|
|||||||
if [ -n "${startbot}" ]; then
|
if [ -n "${startbot}" ]; then
|
||||||
# warn when starting bot without pipe
|
# warn when starting bot without pipe
|
||||||
[ -p "${file}" ] || printf "%b\n" "${ORANGE}Warning${NC}: File is not a pipe:${GREY} ${file##*/}${NC}"
|
[ -p "${file}" ] || printf "%b\n" "${ORANGE}Warning${NC}: File is not a pipe:${GREY} ${file##*/}${NC}"
|
||||||
start_bot "$2"
|
start_bot "$2" "webhook"
|
||||||
printf "${GREEN}Bot start actions done, start reading updates ....${NN}"
|
printf "${GREEN}Bot start actions done, start reading updates ....${NN}"
|
||||||
fi
|
fi
|
||||||
# check file exist
|
# check file exist
|
||||||
@ -74,7 +74,7 @@ fi
|
|||||||
# ready, do stuff here -----
|
# ready, do stuff here -----
|
||||||
|
|
||||||
# kill all sub processes on exit
|
# kill all sub processes on exit
|
||||||
trap 'kill $(jobs -p) 2>/dev/null; printf "Bot in batch mode killed!\n"' EXIT HUP QUIT
|
trap 'kill $(jobs -p) 2>/dev/null; send_normal_message "'"${BOTADMIN}"'" "Bot '"${BOTNAME}"' webhook stopped ..."; printf "Bot in batch mode killed!\n"' EXIT HUP QUIT
|
||||||
|
|
||||||
# use tail to read appended updates
|
# use tail to read appended updates
|
||||||
# shellcheck disable=SC2086,SC2248
|
# shellcheck disable=SC2086,SC2248
|
||||||
|
Loading…
Reference in New Issue
Block a user