tiffmin 已修改 . 還原成這個修訂版本
1 file changed, 31 insertions
shutdown-cron.md(檔案已創建)
| @@ -0,0 +1,31 @@ | |||
| 1 | + | # Script to shutdown my cloud server on the 15th of the month using cron | |
| 2 | + | ||
| 3 | + | ## First, install cron | |
| 4 | + | ||
| 5 | + | `sudo apt update` | |
| 6 | + | ||
| 7 | + | `sudo apt install cron` | |
| 8 | + | ||
| 9 | + | ||
| 10 | + | ## Next enable the cron | |
| 11 | + | `sudo systemctl enable cron` | |
| 12 | + | ||
| 13 | + | ### Use crontab to run the scripts | |
| 14 | + | ||
| 15 | + | I'll be putting a couple of cron jobs on the server to run at specific times. | |
| 16 | + | We can do that with editing the `crontab` file with: | |
| 17 | + | ||
| 18 | + | `sudo nano /etc/crontab` | |
| 19 | + | ||
| 20 | + | > [!NOTE]\ | |
| 21 | + | > This only works on Linux systems | |
| 22 | + | > | |
| 23 | + | ||
| 24 | + | ### The first cron job to run | |
| 25 | + | ||
| 26 | + | ||
| 27 | + | SHELL=/bin/bash | |
| 28 | + | ||
| 29 | + | 0 0 15 * * | |
| 30 | + | ||
| 31 | + | ||
上一頁
下一頁