Last active
May 31, 2022 12:54
-
-
Save ndamulelonemakh/9b6e7bb85af0f65d39374adde549e398 to your computer and use it in GitHub Desktop.
Misc scripts for unix admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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