#!/bin/bash echo "=== 测试调度脚本 ===" echo "时间: $(date '+%Y-%m-%d %H:%M:%S')" # 模拟网页抓取 echo "📡 模拟网页抓取..." sleep 2 echo "✅ 抓取完成,找到3篇文章" # 模拟文章处理 echo "🔄 模拟文章处理..." sleep 1 echo "✅ 文章处理完成" # 模拟小红书发布 echo "📱 模拟小红书发布..." echo "选择文章: AI芯片技术的最新突破" echo "创建测试图片..." # 创建测试图片 python3 -c " from PIL import Image, ImageDraw img = Image.new('RGB', (1080, 1440), color=(70, 130, 180)) draw = ImageDraw.Draw(img) draw.text((100, 600), '测试文章', fill=(255, 255, 255)) draw.text((100, 700), 'AI芯片技术', fill=(255, 255, 200)) img.save('/tmp/test_xhs_image.png') print('测试图片创建完成') " if [ -f /tmp/test_xhs_image.png ]; then echo "🖼️ 测试图片创建成功" # 实际发布(测试模式) echo "🚀 执行小红书发布..." xhs post --title "测试: AI芯片技术" --body "这是自动化系统的测试发布 文章: AI芯片技术的最新突破 来源: 测试系统 时间: $(date '+%Y-%m-%d %H:%M') #技术测试 #自动化 #AI芯片" --images /tmp/test_xhs_image.png 2>&1 | tee -a /tmp/xhs_test_output.txt if [ $? -eq 0 ]; then echo "🎉 小红书发布成功!" # 更新数据库 sqlite3 /home/ubuntu/nanocode/it_automation_enhanced/data/test_articles.db \ "UPDATE articles SET xhs_status = 1 WHERE title LIKE '%AI芯片%'" 2>/dev/null else echo "⚠️ 小红书发布测试完成(可能为模拟)" fi rm -f /tmp/test_xhs_image.png else echo "⚠️ 跳过图片创建和发布" fi echo "✅ 测试流程完成"