#!/bin/sh # description: Start or stop telegram-bash-bot # # example service script to run bashbot in background as specified user # # tested on: ubuntu, opensuse, debian # #### $$VERSION$$ v1.45-dev-66-gec90ce8 # shellcheck disable=SC2009 # shellcheck disable=SC2181 # shellcheck disable=SC2250 # ### BEGIN INIT INFO # Provides: bashbot # Required-Start: $network $syslog # Required-Stop: $network # Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Description: Start or stop telegram-bot-bash server ### END INIT INFO # save default values TERM="" # disable bashbot clear and color output runcmd="echo Dry run:" # not activated until you edit lines below ####################### # Configuration Section # edit the next line to fit the user you want to run bashbot, e.g. nobody: runas="nobody" # uncomment one of the example lines to fit your system # runcmd="su ${runas} -s /bin/bash -c " # runasuser with *su* # runcmd="/usr/sbin/runuser ${runas} -s /bin/bash -c " # runasuser with *runuser* # edit the values of the following lines to fit your config: # your bot name as given to botfather, e.g. mysomething_bot name="" # your bot installation dir bashbotdir="/usr/local/github/telegram-bot-bash-develop/DIST/telegram-bot-bash" databotdir="${bashbotdir}/data-bot-bash" # programs to run bashbot="cd ${bashbotdir}; ${bashbotdir}/bashbot.sh" webhook="cd ${bashbotdir}; ${bashbotdir}/bin/process_batch.sh --startbot --watch ${databotdir}/webhook-fifo-${name} &" # set additionl parameter, e.g. debug mode="" # END Configuration ####################### [ "${name}" = "" ] && name="${runas}" case "$1" in 'start') $runcmd "$bashbot start $mode" # >/dev/null 2>&1 >${bashbotdir}/logs/WEBHOOK.log" # >/dev/null 2>&1 /dev/null 2>&1 fi ;; *) printf "%s\n" "Usage: $0 [ start | stop | restart | starthook | stophook | restarthook ]" printf "%s\n" " $0 [ status | restartback | suspendback | resumeback | killback ]" RETVAL=1 ;; esac exit "${RETVAL}"