Jump to content


roguitar

Member Since 21 Jul 2018
Offline Last Active Aug 09 2020 07:54 PM
-----

Posts I've Made

In Topic: Is it possible to use a chat system here?

04 August 2020 - 12:52 AM

 

subprocess.Popen("/home/roguitar/public_html/chat/server/websocket_server.php")

The next issue I see is that file isn't executable on its own. You need to make it like you did in the cron
subprocess.Popen("/usr/local/bin/ea-php72 /home/roguitar/public_html/chat/server/websocket_server.php")

I've tried this, too and nothing has happened.


In Topic: Is it possible to use a chat system here?

02 August 2020 - 02:16 AM

Well, first of all you're username is 'roguitar' not 'username' so that part of your script isn't going to work until you enter your username like the comments say.

I've tried this, but I couldn't get anything yet.


In Topic: Is it possible to use a chat system here?

28 July 2020 - 03:31 PM

 

You just create a start.py and stop.py cgi scripts based on the idea at https://wiki.helione...opping-your-bot Then when you want to start your script you go to domain.heliohost.org/cgi-bin/start.py and when you want to stop the script you go to domain.heliohost.org/cgi-bin/stop.py

 

Like this?

 

To start:

 

 

#!/usr/bin/python3.6


import os, subprocess, signal


print("Content-Type: text/html\n\n")


counter = 0
p = subprocess.Popen(['ps', '-u', 'username'], stdout=subprocess.PIPE)
# must match your username --------^^^^^^^^


out, err = p.communicate()
for line in out.splitlines():
  if 'websocket_server.php'.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/roguitar/public_html/chat/server/websocket_server.php")
#                         ^^^^^^^^-- be sure to update it to your username


  print("Bot started!")

To stop:

 

 

#!/usr/bin/python3.6


import os, subprocess, signal


print("Content-Type: text/html\n\n")


counter = 0
p = subprocess.Popen(['ps', '-u', 'username'], stdout=subprocess.PIPE)
# must match your username --------^^^^^^^^


out, err = p.communicate()
for line in out.splitlines():
  if 'websocket_server.php'.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.")

Please, correct me if I am wrong...

 

 

 

 

 

 

 

I've tried the code above and the page is blank. And I believe nothing is running.


In Topic: Is it possible to use a chat system here?

28 July 2020 - 02:45 PM

You just create a start.py and stop.py cgi scripts based on the idea at https://wiki.helione...opping-your-bot Then when you want to start your script you go to domain.heliohost.org/cgi-bin/start.py and when you want to stop the script you go to domain.heliohost.org/cgi-bin/stop.py

 

Like this?

 

To start:

 

 

#!/usr/bin/python3.6


import os, subprocess, signal


print("Content-Type: text/html\n\n")


counter = 0
p = subprocess.Popen(['ps', '-u', 'username'], stdout=subprocess.PIPE)
# must match your username --------^^^^^^^^


out, err = p.communicate()
for line in out.splitlines():
  if 'websocket_server.php'.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/roguitar/public_html/chat/server/websocket_server.php")
#                         ^^^^^^^^-- be sure to update it to your username


  print("Bot started!")

To stop:

 

 

#!/usr/bin/python3.6


import os, subprocess, signal


print("Content-Type: text/html\n\n")


counter = 0
p = subprocess.Popen(['ps', '-u', 'username'], stdout=subprocess.PIPE)
# must match your username --------^^^^^^^^


out, err = p.communicate()
for line in out.splitlines():
  if 'websocket_server.php'.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.")

Please, correct me if I am wrong...

 

 

 

 

 


In Topic: Is it possible to use a chat system here?

25 July 2020 - 01:04 PM

Is there any useful information in the email you get when the cron runs?

 

Perhaps it's time to try the cgi method of starting the server since cron doesn't seem to be working? At least that way you can start/stop it as many times a day as you want instead of worrying about exceeding your cron limit.

 

Maybe the cgi method is a bit difficult to me, cuz I don't have any experience.