-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
44 lines (37 loc) · 1016 Bytes
/
Copy pathserver.py
File metadata and controls
44 lines (37 loc) · 1016 Bytes
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
38
39
40
41
42
43
44
from flask import Flask, jsonify
import threading
import subprocess
app = Flask(__name__)
# Track bot process
bot_process = None
@app.route("/")
def home():
return """
<h2>📌 LinkedIn Job Bot Control</h2>
<a href='/start'>▶️ Start Bot</a><br><br>
<a href='/stop'>⏹ Stop Bot</a><br><br>
<a href='/status'>📊 Check Status</a>
"""
@app.route("/start")
def start():
global bot_process
if bot_process is None:
bot_process = subprocess.Popen(["python", "auto_apply.py"])
return "✅ Bot started!"
else:
return "⚠️ Bot is already running."
@app.route("/stop")
def stop():
global bot_process
if bot_process:
bot_process.terminate()
bot_process = None
return "⏹ Bot stopped."
return "⚠️ Bot is not running."
@app.route("/status")
def status():
if bot_process:
return "🟢 Bot is running."
return "🔴 Bot is stopped."
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)