mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 01:39:34 +08:00
[FIX] OpenWRT auto update (#1155)
* switch to root crontab for OpenWRT auto update * fix: OpenWRT auto update restart condition
This commit is contained in:
@@ -329,7 +329,12 @@ if [ "$UNINSTALL" = true ]; then
|
|||||||
|
|
||||||
# Remove the update service if it exists
|
# Remove the update service if it exists
|
||||||
echo "Removing the daily update service..."
|
echo "Removing the daily update service..."
|
||||||
|
# Remove legacy beszel account based crontab file
|
||||||
rm -f /etc/crontabs/beszel
|
rm -f /etc/crontabs/beszel
|
||||||
|
# Install root crontab job
|
||||||
|
if crontab -u root -l 2>/dev/null | grep -q "beszel-agent.*update"; then
|
||||||
|
crontab -u root -l 2>/dev/null | grep -v "beszel-agent.*update" | crontab -u root -
|
||||||
|
fi
|
||||||
|
|
||||||
elif is_freebsd; then
|
elif is_freebsd; then
|
||||||
echo "Stopping and disabling the agent service..."
|
echo "Stopping and disabling the agent service..."
|
||||||
@@ -716,7 +721,7 @@ EXTRA_HELP=" update Update the Beszel agent
|
|||||||
restart Restart the Beszel agent"
|
restart Restart the Beszel agent"
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
if /opt/beszel-agent/beszel-agent update | grep -q "Successfully updated"; then
|
if /opt/beszel-agent/beszel-agent update | grep -q "Update completed successfully"; then
|
||||||
/etc/init.d/beszel-agent restart
|
/etc/init.d/beszel-agent restart
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -745,9 +750,9 @@ EOF
|
|||||||
[Yy]*)
|
[Yy]*)
|
||||||
echo "Setting up daily automatic updates for beszel-agent..."
|
echo "Setting up daily automatic updates for beszel-agent..."
|
||||||
|
|
||||||
cat >/etc/crontabs/beszel <<EOF
|
if ! crontab -u root -l 2>/dev/null | grep -q "beszel-agent.*update"; then
|
||||||
12 0 * * * /etc/init.d/beszel-agent update
|
(crontab -u root -l 2>/dev/null; echo "12 0 * * * /etc/init.d/beszel-agent update") | crontab -u root -
|
||||||
EOF
|
fi
|
||||||
|
|
||||||
/etc/init.d/cron restart
|
/etc/init.d/cron restart
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user