Posted on

Auto-update your Go?

So you want to keep your golang up to date at all times?

Add this to  /bin/go-update, and stick it in your crontab as a daily job, and you will always be up to date.
Rework as needed for your favourite Linux/os distro..

#!/bin/bash
cd /tmp
CVERSION="$(curl -s https://go.dev/VERSION?m=text | grep -o 'go[0-9.]*')"
wget "https://go.dev/dl/${CVERSION}.linux-amd64.tar.gz"
rm -rf /usr/local/go
tar -C /usr/local -xzf "${CVERSION}.linux-amd64.tar.gz"
rm "${CVERSION}.linux-amd64.tar.gz"
go version

Njoy!!

Posted on

Crontab cheat sheet

For all the Linux admins out there – Add this to the header of all your crontabs.
… and it becomes a lot clearer to anyone reading them…

# *   *   *   *   *      command_to_be_executed
# -   -   -   -   -
# |   |   |   |   |
# |   |   |   |   +----- day of the week (0 - 6) (Sunday=0)
# |   |   |   +--------- month (1 - 12)
# |   |   +------------- day of the month (1 - 31)
# |   +----------------- hour (0 - 23)
# +--------------------- min (0 - 59)
#
# Asterisk    (*)  any value
# Comma       (,)  value list separator (0,20,30,45)
# Dash        (-)  range of values (8-17)
# Slash       (/)  steps values (*/20)
#
# @reboot     Run once, at startup
# @yearly     Run once a year,       "0 0 1 1 *"
# @annually   Same as @yearly
# @monthly    Run once a month,      "0 0 1 * *"
# @weekly     Run once a week,       "0 0 * * 0"
# @daily      Run once a day,        "0 0 * * *"
# @hourly     Run once an hour,      "0 * * * *"

Njoy!