• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Search

Archives for May 2023

Add Snapshot Schedules to Disks

May 24, 2023

How to add Snapshot Schedules to disks in Terraform. Add this to your existing VM.

resource "google_compute_disk_resource_policy_attachment" "hourly_attachment" {
  name = "hourly-snapshots"
  disk = google_compute_instance.test.name
  zone = "us-central1-c"
}
 
resource "google_compute_disk_resource_policy_attachment" "daily_attachment" {
  name = "daily-snapshots"
  disk = google_compute_instance.test.name
  zone = "us-central1-c"
}

resource "google_compute_disk_resource_policy_attachment" "hourly_attachment" { name = "hourly-snapshots" disk = google_compute_instance.test.name zone = "us-central1-c" } resource "google_compute_disk_resource_policy_attachment" "daily_attachment" { name = "daily-snapshots" disk = google_compute_instance.test.name zone = "us-central1-c" }

Filed Under: Cloud Tagged With: add, policy, resource, schedules, snapshot, terraform

Unbound Logs

May 24, 2023

How to enable unbound logs.

Add these line in /etc/unbound/unbound.conf.

chroot: ""
logfile: /var/log/unbound.log
verbosity: 4
log-queries: yes

chroot: "" logfile: /var/log/unbound.log verbosity: 4 log-queries: yes

Create the log file and set permissions.

touch /var/log/unbound.log
chown unbound:unbound /var/log/unbound.log

touch /var/log/unbound.log chown unbound:unbound /var/log/unbound.log

Restart the unbound service.

systemctl restart unbound

systemctl restart unbound

Check status.

systemctl status unbound

systemctl status unbound

Finally, check the logs.

tail -f /var/log/unbound.log

tail -f /var/log/unbound.log

Filed Under: Linux Tagged With: logs, unbound

Crontab every 11 months

May 9, 2023

If you want to run a script every 11 months, here’s the crontab entry.

* * 1 */11 * /bin/bash /path/to/script.sh

* * 1 */11 * /bin/bash /path/to/script.sh

Filed Under: Linux Tagged With: 11 months, crontab, every, run

Bash Replace Spaces with a Comma

May 8, 2023

Replace spaces with commas from one file and send the output to another file.

tr -s '[:blank:]' ', ' < input.txt > output.txt

tr -s '[:blank:]' ', ' < input.txt > output.txt

It’s perfect for creating a comma delimited file for importing to Excel.

Filed Under: Linux Tagged With: bash, commas, file, input, output, replace, spaces

  • Home
  • About
  • Search

Copyright © 2023