-
-
Notifications
You must be signed in to change notification settings - Fork 284
/
exec.sh
executable file
·37 lines (35 loc) · 1.15 KB
/
exec.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
RUNDIR=${PWD}
BOTDIR=$(dirname $(realpath ${0}))
UNIXTIME=$(date +%s)
if [ -z ${1} ] || [ ${1} == "-x" ] ; then
cd ${BOTDIR}
. venv/bin/activate
python3 -m userbot
RETVAL=${?}
deactivate
cd ${RUNDIR}
exit $RETVAL
elif [ ${1} == "-d" ] || [ ${1} == "--daemonize" ] ; then
echo -e "I: Running silently in the background like a ninja..."
cd ${BOTDIR}
. venv/bin/activate
nohup python3 -m userbot >>${UNIXTIME}-weebproject.log 2>&1 & echo "I: Userbot PID is ${!}"
deactivate
cd ${RUNDIR}
exit 0
elif [ ${1} == "-h" ] || [ ${1} == "--help" ] ; then
echo -e "WeebProject"
echo -e "Licensed under Raphielscape Public License"
echo -e "\nUsage:"
echo -e "[no arguments] || -x -- Run in the foreground, stdout is the logcat"
echo -e "--daemonize || -d -- Run in the background, logs will be saved in *-weebproject.log"
exit 0
else
echo -e "WeebProject"
echo -e "Licensed under Raphielscape Public License"
echo -e "\nUsage:"
echo -e "[no arguments] || -x -- Run in the foreground, stdout is the logcat"
echo -e "--daemonize || -d -- Run in the background, logs will be saved in *-weebproject.log"
exit 127
fi