浏览代码

fix: create log file with proper permissions during systemd install #37

The install script now creates /var/log/agent-manager.log with proper
ownership and permissions before starting the service. This prevents
the "EACCES: permission denied" error that occurred when the service
tried to create the log file on first startup.

Changes:
- install.sh: Create log file and set ownership to service user
- uninstall.sh: Document that log file is not automatically removed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude 8 月之前
父节点
当前提交
96f41cd71c
共有 2 个文件被更改,包括 10 次插入0 次删除
  1. 8 0
      install.sh
  2. 2 0
      uninstall.sh

+ 8 - 0
install.sh

@@ -145,6 +145,14 @@ rm "$TEMP_SERVICE_FILE"
 # Set correct permissions
 sudo chmod 644 /etc/systemd/system/agent-manager.service
 
+# Create log file with proper permissions
+print_info "Creating log file with proper permissions..."
+LOG_FILE="/var/log/agent-manager.log"
+sudo touch "$LOG_FILE"
+sudo chown "$CURRENT_USER:$CURRENT_GROUP" "$LOG_FILE"
+sudo chmod 644 "$LOG_FILE"
+print_info "Log file created: $LOG_FILE"
+
 # Reload systemd
 print_info "Reloading systemd daemon..."
 sudo systemctl daemon-reload

+ 2 - 0
uninstall.sh

@@ -55,6 +55,7 @@ print_info "Note: This will NOT remove:"
 echo "  - The project directory and files"
 echo "  - Configuration files (.env, commands.json)"
 echo "  - Queue data (queue.json)"
+echo "  - Log file (/var/log/agent-manager.log)"
 echo ""
 
 # Confirm uninstallation
@@ -101,6 +102,7 @@ echo ""
 print_info "The project files remain in place. If you want to remove them:"
 echo "  - Configuration: .env, commands.json"
 echo "  - Queue data: queue.json"
+echo "  - Log file: /var/log/agent-manager.log (remove with: sudo rm /var/log/agent-manager.log)"
 echo "  - Project directory: $PWD"
 echo ""
 print_info "To reinstall the service, run: ./install.sh"