Rebase onto upstream (a4d95fd)
#12
@@ -4,6 +4,7 @@ import asyncio
|
|||||||
import os
|
import os
|
||||||
import select
|
import select
|
||||||
import signal
|
import signal
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@@ -294,6 +295,26 @@ def _make_provider(config):
|
|||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
def _start_moltbook_loop():
|
||||||
|
"""Start the moltbook polling loop in the background."""
|
||||||
|
loop_script = Path.home() / ".nanobot" / "scripts" / "moltbook-loop.sh"
|
||||||
|
log_file = Path.home() / ".nanobot" / "scripts" / "moltbook-loop.log"
|
||||||
|
|
||||||
|
if not loop_script.exists():
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess.Popen(
|
||||||
|
["/bin/bash", str(loop_script)],
|
||||||
|
stdout=open(log_file, "a"),
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
start_new_session=True,
|
||||||
|
)
|
||||||
|
console.print(f"[green]✓[/green] Moltbook polling: every 15m")
|
||||||
|
except Exception as e:
|
||||||
|
console.print(f"[yellow]Warning: Could not start moltbook loop: {e}[/yellow]")
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
def gateway(
|
def gateway(
|
||||||
port: int = typer.Option(18790, "--port", "-p", help="Gateway port"),
|
port: int = typer.Option(18790, "--port", "-p", help="Gateway port"),
|
||||||
@@ -414,6 +435,8 @@ def gateway(
|
|||||||
|
|
||||||
console.print("[green]✓[/green] Heartbeat: every 30m")
|
console.print("[green]✓[/green] Heartbeat: every 30m")
|
||||||
|
|
||||||
|
_start_moltbook_loop()
|
||||||
|
|
||||||
async def run():
|
async def run():
|
||||||
try:
|
try:
|
||||||
await cron.start()
|
await cron.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user