andyye03
-
Posts
6 -
Joined
-
Last visited
Posts posted by andyye03
-
-
My website has been archived
Can you please unarchive it?
id is andyye03
-
Oh shit sorry I didn't realize that they were running
must be a problem with my stop script
-
I tried to use subprocess as a way to continuously run a python script even after closing the browser, using the start and stop pages on https://flazepe.gitbook.io/heliohost/tutorials/discord-bot
But no matter how long I waited, the script only ran when the "start" page was open, and when I tried to stop the script, it told me that there was no script to stop.
my start script is
#!/usr/bin/python3.7
print("Content-Type: text/html\n\n")
import os, subprocess, signal
counter = 0
p = subprocess.Popen(['ps', '-u', 'andyye03'], stdout=subprocess.PIPE)
# must match your username --------^^^^^^^^
out, err = p.communicate()
for line in out.splitlines():
if 'gaonnuriallimi.py'.encode('utf-8') in line:
# ^^^^^^^^^^^----- this has to match the filename of your bot script
counter += 1
print("Bot already running.")
if counter == 0:
subprocess.Popen("/home/andyye03/gaonnuriallimi.py")
# ^^^^^^^^-- be sure to update it to your username
print("Bot started!")and my stop script is
#!/usr/bin/python3.7
import os, subprocess, signal
print("Content-Type: text/html\n\n")
counter = 0
p = subprocess.Popen(['ps', '-u', 'andyye03'], stdout=subprocess.PIPE)
# must match your username --------^^^^^^^^
out, err = p.communicate()
for line in out.splitlines():
if 'gaonnuriallimi.py'.encode('utf-8') in line:
# ^^^^^^^--- this has to match the filename of your loop
counter += 1
pid = int(line.split(None, 1)[0])
print("Stopping bot.")
os.kill(pid, signal.SIGTERM)
if counter == 0:
print("Already stopped.") -
I wrote some code that continuously checks a site for changes and emails me when the change is made. However, the python script only seems to work when the site is open on the browser.
Is there any way to prevent this? I want my script to keep running even after I leave the webpage.
-
I am on server johnny and
I need the libraries (edit:modules sorry)
requests
bs4
smtplib
ssl
os
email
on my account with python 3.7
Can you please help
[Solved] Please unarchive my account
in Escalated Requests
Posted
Thanks xD