OverviewFilesCommitsIssuesDocsReleasesPeers

hypercore-kb / opencog-kb / language-learning / chatbot / start-learner.sh

38 lines · bash ref:
#!/bin/bash
# Start the AtomSpace learning daemon
cd "$(dirname "$0")"

SOCK="/tmp/atomspace-learner.sock"
PID_FILE="/tmp/atomspace-learner.pid"
LOG="/tmp/atomspace-learner.log"

if [ -S "$SOCK" ]; then
    echo "Daemon may already be running (socket exists)"
    echo "To restart: ./stop-learner.sh && ./start-learner.sh"
    exit 1
fi

echo "Starting AtomSpace Learning Daemon..."
echo "Log: $LOG"
echo ""
echo "Query:  ./ask.sh /stats"
echo "        ./ask.sh /layers"
echo "        ./ask.sh 'what is keypair'"
echo "Watch:  tail -f $LOG"
echo ""

# Run in background
nohup guile atomspace-daemon.scm run > "$LOG" 2>&1 &
echo $! > "$PID_FILE"

sleep 2

if [ -S "$SOCK" ]; then
    echo "Daemon started (PID: $(cat $PID_FILE))"
    echo ""
    # Show initial layers
    ./ask.sh /layers
else
    echo "Failed to start. Check: tail $LOG"
fi