Check for OS upgrade to Ubuntu automatically everyday.

Here’s a single script that will update your system and schedule the do-release-upgrade command to run at 12:30 AM every day:

#!/bin/bash

# Update and upgrade the system
sudo apt update
sudo apt upgrade -y

# Create the upgrade script
cat <<EOL > ~/upgrade.sh
#!/bin/bash
sudo apt update
sudo apt upgrade -y
sudo do-release-upgrade -f DistUpgradeViewNonInteractive
EOL

# Make the upgrade script executable
chmod +x ~/upgrade.sh

# Schedule the upgrade script to run at 12:30 AM every day
(crontab -l 2>/dev/null; echo "30 0 * * * /home/your_username/upgrade.sh") | crontab -

echo "Upgrade script created and scheduled to run at 12:30 AM every day."

Replace your_username with your actual username in the script. This script will update and upgrade your system, create the upgrade.sh script, make it executable, and schedule it to run at 12:30 AM every day using cron.

Comments

Popular posts from this blog

Clearing DNS cache on vCenter Server Appliance

Start and stop services in vCenter Server Appliance

How to step by step in detail install ssh on cachyos