diff --git a/.editorconfig b/.editorconfig index 2087dd7..9897775 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,5 +8,11 @@ indent_style = space indent_size = 4 end_of_line = lf charset = utf-8 -trim_trailing_whitespace = false +trim_trailing_whitespace = true insert_final_newline = true + +[{*.service,*.timer}] +indent_style = tab +indent_size = 4 +insert_final_newline = false +trim_trailing_whitespace = true diff --git a/README.md b/README.md index dbaa58b..7da3c98 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,22 @@ git clone https://devops.lty.name/luo/backupd.git /opt/backupd ``` ## Configuration -**Ownership** +> +> **Note** +> +> You have to complete ALL FOLLOWING STEPS to make the script work properly. +> -Don't forget to change the ownership of the directory: +**Permissions** + +Don't forget to change the ownership and permissions of the files: ```bash chown -R root:root /opt/backupd +cd /opt/backupd +for file in *.example; do + mv "$file" "${file%.example}" +done +chmod 600 rclone.conf passwd ``` **Rclone** @@ -65,7 +76,7 @@ If you wish to run the script as scheduled tasks, copy the fillowing files to `/ ```bash cp /opt/backupd/backupd.service /etc/systemd/system/ -cp /opt/backupd/backupd.timer /etc/systemd/system/ +cp /opt/backupd/backupd.timer /etc/systemd/system/ ``` Then, enable and start the timer: diff --git a/backupd.service b/backupd.service new file mode 100644 index 0000000..85a3b27 --- /dev/null +++ b/backupd.service @@ -0,0 +1,7 @@ +[Unit] +Description=A simple backup script +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/opt/backupd/backupd \ No newline at end of file diff --git a/backupd.timer b/backupd.timer new file mode 100644 index 0000000..5d842d1 --- /dev/null +++ b/backupd.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Run backupd daily + +[Timer] +OnCalendar=*-*-* 09:00:00 UTC +Persistent=true + +[Install] +WantedBy=timers.target \ No newline at end of file