test if script/job exist and is executable, more cleanup on startup

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-05-20 12:12:11 +02:00
parent 9482bd62bf
commit 3c5ffdb506
3 changed files with 8 additions and 6 deletions

View File

@ -12,7 +12,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.80-pre-1-gb8ae9ec
#### $$VERSION$$ v0.80-pre-2-g9482bd6
#
# Exit Codes:
# - 0 sucess (hopefully)
@ -364,8 +364,9 @@ start_bot() {
[[ "${DEBUG}" = *"debug" ]] && exec &>>"DEBUG.log"
[ "${DEBUG}" != "" ] && date && echo "Start BASHBOT in Mode \"${DEBUG}\""
[[ "${DEBUG}" = "xdebug"* ]] && set -x
#cleaup old pipes
#cleaup old pipes and empty logfiles
find "${TMPDIR}" -type p -delete
find "${TMPDIR}" -size 0 -name "*.log" -delete
while true; do
UPDATE="$(getJson "$UPD_URL$OFFSET" | "${JSONSHFILE}" -s -b -n)"

View File

@ -5,7 +5,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.80-pre-0-gdd7c66d
#### $$VERSION$$ v0.80-pre-2-g9482bd6
# source from commands.sh if you want ro use interactive or background jobs
@ -48,6 +48,7 @@ start_back() {
# $3 prefix
start_proc() {
[ "$2" = "" ] && return
[ -x "${2%% *}" ] || return 1
local fifo; fifo="${TMPDIR:-.}/$(procname "$1" "$3")"
kill_proc "$1" "$3"
mkfifo "${fifo}"

View File

@ -2,7 +2,7 @@
# files: mycommands.sh.dist
# copy to mycommands.sh and add all your commands and functions here ...
#
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
#### $$VERSION$$ v0.80-pre-2-g9482bd6
#
# uncomment the following lines to overwrite info and help messages
@ -30,7 +30,7 @@ if [ "$1" != "source" ];then
'/question'*) # start interactive questions
checkproc
if [ "$res" -gt 0 ] ; then
startproc "examples/question.sh"
startproc "examples/question.sh" || _message "Can't start question."
else
send_normal_message "${CHAT[ID]}" "$MESSAGE already running ..."
fi
@ -39,7 +39,7 @@ if [ "$1" != "source" ];then
'/run_notify'*) # start notify background job
myback="notify"; checkback "$myback"
if [ "$res" -gt 0 ] ; then
background "examples/notify.sh 60" "$myback" # notify every 60 seconds
background "examples/notify.sh 60" "$myback" || _message "Can't start notify."
else
send_normal_message "${CHAT[ID]}" "Background command $myback already running ..."
fi