-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_security.sh
More file actions
33 lines (27 loc) · 1.03 KB
/
Copy pathupdate_security.sh
File metadata and controls
33 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Linux Sunucuda Güncellemeleri ve Güvenlik Kontrollerini Otomatik Yapan Script
# Bu script, sistem güncellemelerini kontrol eder, güvenlik yamalarını uygular ve eski paketleri temizler.
# Güncellemeleri kontrol et ve uygula
echo "Sistem güncellemeleri kontrol ediliyor..."
apt-get update && apt-get upgrade -y
if [[ $? -eq 0 ]]; then
echo "Sistem başarıyla güncellendi."
else
echo "Güncelleme sırasında hata oluştu!"
fi
# Kernel güncellemelerini kontrol et
echo "Kernel güncellemeleri kontrol ediliyor..."
apt-get dist-upgrade -y
# Gereksiz eski paketleri kaldır
echo "Eski ve gereksiz paketler temizleniyor..."
autoremove_output=$(apt-get autoremove -y)
if [[ -n "$autoremove_output" ]]; then
echo "Gereksiz paketler kaldırıldı."
else
echo "Kaldırılacak gereksiz paket bulunamadı."
fi
# Güvenlik yamalarını uygula
echo "Güvenlik yamaları yükleniyor..."
apt-get install unattended-upgrades -y
unattended-upgrades --dry-run
echo "Sistem güncelleme ve güvenlik kontrolü tamamlandı."