Code to Run Updates in the Terminal Daily

Append this to your .zshrc to apply updates:

### updates
TIMESTAMP_FILE="/tmp/update.timestamp"
if [ ! -e "$TIMESTAMP_FILE" ] ; then
    touch --date=2000-01-01 "$TIMESTAMP_FILE"
fi

if find "$TIMESTAMP_FILE" -mmin +3600 | grep "$TIMESTAMP_FILE" ; then
    echo "*******************"
    echo "** Let's Update! **"
    echo "*******************"
    touch "$TIMESTAMP_FILE"
    /home/johnk/bin/update.sh
    sshk "sh update-wp.sh"
fi

Code language: PHP (php)

I prefer to update from the command line, because it’s less intrusive to me.

This script runs when the Terminal opens a shell. That’s why I check that it’s already run within the past day.

The update.sh script runs apt upgrade, and then flatpak update.

The ssh command runs an update script for wordpress, up on the server.

admin
Author: admin

This is the server’s system administrator. This site is undergoing some changes.