Jump to content

Recommended Posts

Posted (edited)

Ok so :

 

I've followed all the steps to start and stop the bot, but i've replaced the .py bot by server.js (my server script, placed in root directory). I've added the same permissions. Is that what was expected ?

Unfortunately  citadel.helioho.st/bot_control/ only shows

Cannot GET /bot_control/

i've also tried the full adress :
console error : bot_control/:1 
            
            
           GET https://citadel.helioho.st/httpdocs/bot_control/ 404 (Not Found)

The tutorial said to check the bot logs but i cannot find them in the bot_control dir. There are logs in the log dir, but i don't know which ones are the bot one.

Am I on a wrong track ?

Edited by gofterdom
Posted

Ok i managed to find it by going directyly to https://citadel.helioho.st/bot_control/index.sh

but now it's giving me errors, that seems like it's expecting a python document and not a js document, the comments are not read as comment...

 

server.js is not running. Start - Check Load

Logs: Clear Logs - Full Logs

[2025-06-27 12:22:07] Starting server.js.
  File "/home/citadel.helioho.st/server.js", line 321
    // Only add tiles that don't already exist at those coordinates
                              ^
SyntaxError: unterminated string literal (detected at line 321)
[2025-06-27 12:22:11] Starting server.js.
  File "/home/citadel.helioho.st/server.js", line 321
    // Only add tiles that don't already exist at those coordinates
                              ^
SyntaxError: unterminated string literal (detected at line 321)
Posted

I THINK i managed to adapt the bash script to start the node.js server.js script using passenger, but it feels like there is not much i can do now, since ports are not open to me...

I don't know how to stop the node using passenger though. Can you please help me with the next steps ?

 

server.js is not running. Start - Check Load

Logs: Clear Logs - Full Logs

[2025-06-27 13:38:48] Restarting server.js.
[2025-06-27 13:39:22] Restarting server.js.
[2025-06-27 13:39:27] Restarting server.js.
[2025-06-27 13:42:32] Restarting server.js.

 

 

 

#!/bin/bash

# edit this to match your bot filename
bot_name="server.js"

###################################################################

printf 'Content-Type: text/html\n\n'
username=`whoami`
pwd=`printenv|grep '^PWD'|cut -f2 -d'='`
main_domain=`echo "$pwd"|cut -f3 -d'/'`
control=`echo "$pwd"|cut -f5 -d'/'`
temp=`ps axo user:16,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,command|grep -v grep|grep "^$username "`
running=`echo "$temp"|grep -c "$bot_name"`
file_base=`echo $bot_name|tr -cd "a-zA-Z0-9"`
log_name="$file_base.txt"

if [ "$QUERY_STRING" == "" ]; then
    if [ $running -ne 0 ]; then
        mem_kb=`echo "$temp"|grep "$bot_name"|awk '{print $6}'`
        mem_mb=$( echo "scale=2;$mem_kb/1024"|bc )
        mem_24=$( echo "scale=2;$mem_kb*1440/1048576"|bc )
        echo "$bot_name is running. <a href='?action=stop'>Stop</a><br>Current memory usage: $mem_mb MB<br>Estimated 24 hour usage: $mem_24 GB - "
    else
        echo "$bot_name is not running. <a href='?action=start'>Start</a> - "
    fi
    echo "<a href='https://heliohost.org/dashboard/load/' target='_blank'>Check Load</a><br><br>Logs: <a href='?action=clear'>Clear Logs</a> - <a href='/$control/$log_name'>Full Logs</a><pre>"
    tail -30 $pwd/$log_name
    echo "</pre><script>reloading = setTimeout('window.location.reload();', 10000);</script>"
fi

ts=`date +"%Y-%m-%d %H:%M:%S"`

if [ "$QUERY_STRING" == "action=stop" ]; then
    echo "[$ts] Stop action requested for $bot_name." >> $pwd/$log_name
    echo "Stop action triggered. You must handle graceful shutdown inside your app.<br>"
    echo "<script>setInterval(\"window.location.replace('/$control/');\", 2000);</script>"
fi

if [ "$QUERY_STRING" == "action=start" ]; then
    echo "[$ts] Restarting $bot_name." >> $pwd/$log_name
    touch "$pwd/../tmp/restart.txt"
    echo "Restart triggered for $bot_name.<script>window.location.replace('/$control/');</script>"
fi

if [ "$QUERY_STRING" == "action=clear" ]; then
    cat /dev/null > $pwd/$log_name
    echo "Clearing logs...<script>window.location.replace('/$control/');</script>"
fi

exit 0
 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...