diff --git a/testing/validate-interworx.sh b/testing/validate-interworx.sh index 818da33..aee39a2 100755 --- a/testing/validate-interworx.sh +++ b/testing/validate-interworx.sh @@ -140,11 +140,12 @@ if [ -n "$TEST_USER" ] && [ -n "$TEST_DOMAIN" ]; then if [ -d "$EXPECTED_LOG_DIR" ]; then test_pass "Log directory exists: $EXPECTED_LOG_DIR" - # Check for specific log files - if [ -f "$EXPECTED_LOG_DIR/access_log" ]; then - test_pass "Access log exists: $EXPECTED_LOG_DIR/access_log" + # Check for specific log files (InterWorx uses transfer.log NOT access_log) + if [ -f "$EXPECTED_LOG_DIR/transfer.log" ]; then + test_pass "Access log exists: $EXPECTED_LOG_DIR/transfer.log" + test_pass "VERIFIED: InterWorx uses 'transfer.log' for access logs" else - test_warn "Access log NOT found (may not have traffic yet)" + test_warn "Access log NOT found (may not have traffic yet or may be symlink)" fi if [ -f "$EXPECTED_LOG_DIR/error_log" ]; then @@ -522,13 +523,20 @@ if [ -n "$FIRST_WP" ]; then crontab -u "$WP_USER" -l > "$TEMP_BACKUP" 2>/dev/null || echo "# No existing crontab" > "$TEMP_BACKUP" (crontab -u "$WP_USER" -l 2>/dev/null; echo "# TEST - InterWorx Validation") | crontab -u "$WP_USER" - 2>/dev/null - if [ $? -eq 0 ]; then + CRON_WRITE_STATUS=$? + + if [ "$CRON_WRITE_STATUS" -eq 0 ]; then test_pass "✓ CAN WRITE crontab for user: $WP_USER" test_pass "ANSWER: Use 'crontab -u $WP_USER' for WordPress cron jobs" - crontab -u "$WP_USER" "$TEMP_BACKUP" 2>/dev/null - test_info "Test entry removed, crontab restored" + if crontab -u "$WP_USER" "$TEMP_BACKUP" 2>/dev/null; then + test_info "Test entry removed, crontab restored" + else + test_warn "Failed to restore original crontab - manual check recommended" + fi else test_fail "✗ CANNOT WRITE crontab for user: $WP_USER" + # Attempt to restore anyway in case partial write occurred + crontab -u "$WP_USER" "$TEMP_BACKUP" 2>/dev/null fi rm -f "$TEMP_BACKUP" fi @@ -742,7 +750,7 @@ echo "=======================================================================" > echo "" >> "$RESULTS_FILE" echo "Home directories: /home/USERNAME/" >> "$RESULTS_FILE" echo "Document roots: /home/USERNAME/DOMAIN/html/" >> "$RESULTS_FILE" -echo "Access logs: /home/USERNAME/var/DOMAIN/logs/access_log" >> "$RESULTS_FILE" +echo "Access logs: /home/USERNAME/var/DOMAIN/logs/transfer.log (VERIFIED)" >> "$RESULTS_FILE" echo "Error logs: /home/USERNAME/var/DOMAIN/logs/error_log" >> "$RESULTS_FILE" echo "WordPress: /home/USERNAME/DOMAIN/html/wp-config.php" >> "$RESULTS_FILE" echo "Vhost configs: /etc/httpd/conf.d/vhost_*.conf" >> "$RESULTS_FILE" diff --git a/testing/validate-plesk.sh b/testing/validate-plesk.sh index 9d88bfe..5e10cb0 100755 --- a/testing/validate-plesk.sh +++ b/testing/validate-plesk.sh @@ -246,7 +246,8 @@ if [ -n "$TEST_DOMAIN" ]; then # Look for Owner field - Plesk uses "Owner's contact name:" format # Example: "Owner's contact name: LW Support (admin)" -> extract "admin" - OWNER=$(echo "$SUBSCRIPTION_INFO" | grep -i "^Owner's contact name:" | sed "s/^Owner's contact name:[[:space:]]*//" | grep -o '([^)]*)' | tr -d '()') + # Uses tail -1 to get the last parentheses in case of multiple + OWNER=$(echo "$SUBSCRIPTION_INFO" | grep -i "^Owner's contact name:" | sed "s/^Owner's contact name:[[:space:]]*//" | grep -oE '\([^)]+\)' | tail -1 | tr -d '()') if [ -n "$OWNER" ]; then test_pass "Found Owner's contact name field: $OWNER" @@ -496,17 +497,23 @@ if command -v crontab &> /dev/null; then # Try to add a test entry TEST_CRON_ENTRY="# TEST ENTRY - Plesk Validation - Will be removed" (crontab -u "$CRON_USER" -l 2>/dev/null; echo "$TEST_CRON_ENTRY") | crontab -u "$CRON_USER" - 2>/dev/null + CRON_WRITE_STATUS=$? - if [ $? -eq 0 ]; then + if [ "$CRON_WRITE_STATUS" -eq 0 ]; then test_pass "✓ CAN WRITE crontab for user: $CRON_USER" test_pass "ANSWER: Standard crontab works - use 'crontab -u $CRON_USER'" # Restore original crontab immediately - crontab -u "$CRON_USER" "$TEMP_BACKUP" 2>/dev/null - test_info "Test entry removed, original crontab restored" + if crontab -u "$CRON_USER" "$TEMP_BACKUP" 2>/dev/null; then + test_info "Test entry removed, original crontab restored" + else + test_warn "Failed to restore original crontab - manual check recommended" + fi else test_fail "✗ CANNOT WRITE crontab for user: $CRON_USER" test_warn "May need to use 'plesk bin cron' instead of standard crontab" + # Attempt to restore anyway in case partial write occurred + crontab -u "$CRON_USER" "$TEMP_BACKUP" 2>/dev/null fi rm -f "$TEMP_BACKUP" @@ -930,7 +937,7 @@ TOTAL TESTS: $TOTAL Completed: $(date) EOF -if [ $FAIL -eq 0 ]; then +if [ "$FAIL" -eq 0 ]; then echo -e "${GREEN}✓ ALL CRITICAL TESTS PASSED${NC}" echo "✓ ALL CRITICAL TESTS PASSED" >> "$RESULTS_FILE" echo ""