Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Cronjob management, report #7970

Open
darkjackx opened this issue Feb 23, 2025 · 1 comment
Open

[Feature] Cronjob management, report #7970

darkjackx opened this issue Feb 23, 2025 · 1 comment

Comments

@darkjackx
Copy link

darkjackx commented Feb 23, 2025

1Panel Version

v1.10.25-lts

Please describe your needs or suggestions for improvements

My 1panel run some cronjob every minutes, and set the status as failed if the result not right.
Then the cronjob report will get a lot of invalid logs, it affects to monitoring successful logs.
So, I created a script to delete all invalid logs containing "### mark this for dropping logs ###"
And generate a sql statement to clean those logs in database.

#!/bin/bash

# Step 1: 搜尋包含特定標記的檔案
files=$(grep -rl "### mark this for dropping logs ###" /opt/1panel/task/shell/ --include="*.log")

# 檢查是否找到檔案
if [ -z "$files" ]; then
    echo "未找到含有 '### mark this for dropping logs ###' 的檔案"
    exit 0
fi

# Step 2: 將檔案路徑格式化為 SQL 可用格式
files_path=$(echo "$files" | awk '{printf "\x27%s\x27,", $0}' | sed 's/,$//')

# Debug: 輸出格式化後的檔案路徑
echo "格式化後檔案路徑: $files_path"

# Step 3: 執行 SQL 刪除語句
sqlite3 /opt/1panel/db/1Panel.db <<EOF
DELETE FROM job_records WHERE records IN ($files_path);
EOF

echo "SQL 刪除語句已執行成功。"

# Step 4: 刪除實際檔案
echo "正在刪除以下檔案:"
echo "$files"
rm -f $files

echo "檔案刪除完成。"

Please describe the solution you suggest

  1. improve the report list
    Please can you set the list amount per page limit to 1000 logs ? 14 is too less.
    Or set a magic keywords to drop current log, when run cronjob not in expectation.

  2. the cronjob list now sort by created date default.
    Is it possible to save the sort selection in system or cookie

  3. please add a "a href=" tag to 1panel logo

<div data-v-cc3572a1="" class="logo" style="cursor: pointer;">

It will be a super shortcut to open new tab for 1panel console by middle click of mouse

Additional Information

No response

@wanghe-fit2cloud
Copy link
Member

Thank you for the feedback. We will consider this request in a future version and continue to optimize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants