diff --git a/.gitignore b/.gitignore index 199801b..eac95af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ env env.json -__pycache__ \ No newline at end of file +__pycache__ +run_logs.txt \ No newline at end of file diff --git a/README.md b/README.md index a1d38bd..24dbaf1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ How to get Twitter API keys: Give the tokens and keys to the env.json file (a sample is given, follow that naming convention only) Run the main.py file and voila, now send any text to your telegram bot and it will tweet it +Or you can run the start.sh file to start a background process. And stop.sh to kill the process Telegram bot commands /start: displays a info message diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..ee5f92c --- /dev/null +++ b/start.sh @@ -0,0 +1,7 @@ +# !/bin/bash +echo $HOME +source "$HOME/tweet-from-message/env/bin/activate" +echo Starting Bot... +python main.py > run_logs.txt & +sleep 3 +echo Bot started. \ No newline at end of file diff --git a/stop.sh b/stop.sh new file mode 100644 index 0000000..e96a3f1 --- /dev/null +++ b/stop.sh @@ -0,0 +1,2 @@ +# !/bin/bash +kill -9 $(ps aux | grep "[p]ython main.py" | awk '{print $2}') \ No newline at end of file