Skip to content

Instantly share code, notes, and snippets.

@ndamulelonemakh
Last active May 31, 2022 12:54
Show Gist options
  • Select an option

  • Save ndamulelonemakh/9b6e7bb85af0f65d39374adde549e398 to your computer and use it in GitHub Desktop.

Select an option

Save ndamulelonemakh/9b6e7bb85af0f65d39374adde549e398 to your computer and use it in GitHub Desktop.
Misc scripts for unix admin
# Install cron to sun scheduled scripts
sudo apt update
sudo apt install cron
sudo systemctl enable cron
# Add you config in crontab
crontab -e
# Syntax (Reference: https://www.digitalocean.com/community/tutorials/how-to-use-cron-to-automate-tasks-ubuntu-1804)
# minute hour dayofMonth month dayOfWeek <you-commands>
# e.g. print hello world every 5 minutes
*/5 * * * * echo "hello world"
# You can also use special syntax to define your schedules e.g.
@hourly curl www.google.com
@monthly rm -rfv /tmp/*.log
# or run a script on every boot
@reboot grep CRON /var/log/syslog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment