mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
commit
1e25e36ce6
195 files changed
+152301
No files matched your search
@@ -0,0 +1,26 @@
|
||||
MAILTO="alert@tyates.one"
|
||||
0 */6 * * * root apt-get update && apt install upgrade -y && apt-get -y -d full-upgrade && apt-get autoremove -y
|
||||
|
||||
#* */4 * * * /home/pi/Desktop/sync.sh
|
||||
# sudo apt-get update
|
||||
# sudo apt-get upgrade -y
|
||||
|
||||
|
||||
#https://crontab-generator.org/
|
||||
#apt-get install cron-apt -y
|
||||
#https://www.techrepublic.com/article/automatically-update-your-ubuntu-system-with-cron-apt/
|
||||
#https://www.linuxfordevices.com/tutorials/linux/automatic-updates-cronjob
|
||||
|
||||
|
||||
#[minute] [hour] [day_of_month] [month] [day_of_week] [user] [command_to_run]
|
||||
|
||||
#0 0 * * 0 root (apt-get update && apt-get -y -d upgrade)
|
||||
|
||||
sudo apt install cron cron-apt -y
|
||||
sudo systemctl enable cron
|
||||
sudo nano /etc/crontab
|
||||
|
||||
#MAILTO="alerts@tyates.one"
|
||||
#0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y
|
||||
|
||||
#sudo apt-get update && sudo apt-get full-upgrade -y && sudo apt autoremove -y
|
||||
@@ -0,0 +1,44 @@
|
||||
<<<<<<< HEAD
|
||||
# cron-job-setup-files
|
||||
|
||||
## Purpose
|
||||
This directory contains files related to **cron job setup files**.
|
||||
|
||||
## Contents
|
||||
- `setup_cron_job_updates-nomount.sh`
|
||||
- `CronUpdates-readme.txt`
|
||||
- `setup_cron_job_updates.sh`
|
||||
|
||||
## Usage
|
||||
- Review each script or configuration file before running
|
||||
- Some scripts may require **root or sudo**
|
||||
- Paths and variables may need adjustment for your environment
|
||||
|
||||
## Notes
|
||||
- This folder is part of the **public-setupfiles** repository
|
||||
- Files are provided as-is for reference or automation
|
||||
|
||||
## Safety
|
||||
Always back up data before running scripts that modify system state.
|
||||
=======
|
||||
# cron-job-setup-files
|
||||
|
||||
## Overview
|
||||
This directory is part of the **public-setupfiles** repository.
|
||||
It contains scripts, configuration files, or resources related to **cron-job-setup-files**.
|
||||
|
||||
## Usage
|
||||
- Review scripts before execution
|
||||
- Some files may require **root or sudo privileges**
|
||||
- Paths, variables, or credentials may need customization
|
||||
|
||||
## Logging & Output
|
||||
Scripts may generate logs or output files in the same directory or system locations.
|
||||
|
||||
## Safety Notes
|
||||
- Always back up important data before running scripts
|
||||
- Test in a non-production environment when possible
|
||||
- Use at your own risk
|
||||
|
||||
---
|
||||
>>>>>>> main
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script: setup_auto_updates.sh
|
||||
# Description: Configure automatic system updates via cron on Debian 12
|
||||
|
||||
# Exit immediately on error
|
||||
set -e
|
||||
|
||||
# Update package lists and install cron
|
||||
sudo apt update
|
||||
sudo apt install -y cron
|
||||
|
||||
# Enable and start the cron service
|
||||
sudo systemctl enable cron
|
||||
sudo systemctl restart cron
|
||||
|
||||
# Write the cron job to /etc/cron.d/auto_updates properly using EOF
|
||||
sudo tee /etc/cron.d/auto_updates > /dev/null << 'EOF'
|
||||
MAILTO="alerts@tyates.one"
|
||||
0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y && apt-get clean -y && apt-get purge -y
|
||||
EOF
|
||||
|
||||
# Set proper permissions
|
||||
sudo chmod 644 /etc/cron.d/auto_updates
|
||||
sudo chown root:root /etc/cron.d/auto_updates
|
||||
|
||||
echo "[✓] Auto update cron job installed. Runs every 6 hours."
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script: setup_auto_updates.sh
|
||||
# Description: Script to set up automatic system updates using cron
|
||||
|
||||
# Update package lists and install cron
|
||||
sudo apt update
|
||||
sudo apt install cron -y
|
||||
|
||||
# Enable and start the cron service
|
||||
sudo systemctl enable cron
|
||||
sudo systemctl start cron
|
||||
|
||||
# Stop the cron service to make changes
|
||||
sudo systemctl stop cron
|
||||
|
||||
# Add the update and upgrade cron job to /etc/cron.d/
|
||||
# Old line that doesnt work
|
||||
# echo 'MAILTO="alerts@tyates.one"
|
||||
# 0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y && sudo apt-get clean -y && sudo apt-get purge -y' | sudo tee /etc/cron.d/auto_updates
|
||||
|
||||
# Add the update and upgrade cron job to /etc/cron.d/auto_updates
|
||||
echo 'MAILTO="alerts@tyates.one"
|
||||
0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y && sudo apt-get clean -y && sudo apt-get purge -y
|
||||
0 */1 * * * root mount -a' | sudo tee /etc/cron.d/auto_updates
|
||||
|
||||
# Restart the cron service to apply the new cron job
|
||||
sudo systemctl start cron
|
||||
Reference in new issue
Block a user