BASH_SRV Telegram 123
🚀 Автоматическое обновление пакетов с логированием

Регулярные обновления системы — залог безопасности и стабильности.
Ниже скрипт, который обновляет пакеты и ведёт лог:


#!/bin/bash
# автор: https://www.tgoop.com/bash_srv

LOGFILE="/var/log/auto_update.log"
DATE=$(date '+%Y-%m-%d %H:%M:%S')

echo "[$DATE] Начало обновления" >> $LOGFILE

if command -v apt &>/dev/null; then
apt update >> $LOGFILE 2>&1
apt -y upgrade >> $LOGFILE 2>&1
elif command -v dnf &>/dev/null; then
dnf -y update >> $LOGFILE 2>&1
elif command -v yum &>/dev/null; then
yum -y update >> $LOGFILE 2>&1
else
echo "[$DATE] Неизвестный пакетный менеджер" >> $LOGFILE
exit 1
fi

echo "[$DATE] Обновление завершено" >> $LOGFILE


📌 Как использовать:

1. Сохраните скрипт, например, /usr/local/bin/auto_update.sh

2. Дайте права на выполнение:

chmod +x /usr/local/bin/auto_update.sh


3. Добавьте в cron для ежедневного запуска:

0 3 * * * /usr/local/bin/auto_update.sh


Теперь сервер будет обновляться сам, а все действия попадут в лог 📜

👉@bash_srv
👍7🤔2



tgoop.com/bash_srv/123
Create:
Last Update:

🚀 Автоматическое обновление пакетов с логированием

Регулярные обновления системы — залог безопасности и стабильности.
Ниже скрипт, который обновляет пакеты и ведёт лог:


#!/bin/bash
# автор: https://www.tgoop.com/bash_srv

LOGFILE="/var/log/auto_update.log"
DATE=$(date '+%Y-%m-%d %H:%M:%S')

echo "[$DATE] Начало обновления" >> $LOGFILE

if command -v apt &>/dev/null; then
apt update >> $LOGFILE 2>&1
apt -y upgrade >> $LOGFILE 2>&1
elif command -v dnf &>/dev/null; then
dnf -y update >> $LOGFILE 2>&1
elif command -v yum &>/dev/null; then
yum -y update >> $LOGFILE 2>&1
else
echo "[$DATE] Неизвестный пакетный менеджер" >> $LOGFILE
exit 1
fi

echo "[$DATE] Обновление завершено" >> $LOGFILE


📌 Как использовать:

1. Сохраните скрипт, например, /usr/local/bin/auto_update.sh

2. Дайте права на выполнение:

chmod +x /usr/local/bin/auto_update.sh


3. Добавьте в cron для ежедневного запуска:

0 3 * * * /usr/local/bin/auto_update.sh


Теперь сервер будет обновляться сам, а все действия попадут в лог 📜

👉@bash_srv

BY Bash Советы




Share with your friend now:
tgoop.com/bash_srv/123

View MORE
Open in Telegram


Telegram News

Date: |

Although some crypto traders have moved toward screaming as a coping mechanism, several mental health experts call this therapy a pseudoscience. The crypto community finds its way to engage in one or the other way and share its feelings with other fellow members. Hui said the time period and nature of some offences “overlapped” and thus their prison terms could be served concurrently. The judge ordered Ng to be jailed for a total of six years and six months. Ng was convicted in April for conspiracy to incite a riot, public nuisance, arson, criminal damage, manufacturing of explosives, administering poison and wounding with intent to do grievous bodily harm between October 2019 and June 2020. Avoid compound hashtags that consist of several words. If you have a hashtag like #marketingnewsinusa, split it into smaller hashtags: “#marketing, #news, #usa. For crypto enthusiasts, there was the “gm” app, a self-described “meme app” which only allowed users to greet each other with “gm,” or “good morning,” a common acronym thrown around on Crypto Twitter and Discord. But the gm app was shut down back in September after a hacker reportedly gained access to user data.
from us


Telegram Bash Советы
FROM American