sample.service file
you have to copy it to
/etc/systemd/system
sudo systemctl enable sample.service
| #!/bin/bash | |
| # This script will create a compressed data dump | |
| # that can be restored in parallel using | |
| # pg_restore -C -j[num of cores] -d postgres 2015-09-30-app_db.dump | |
| # note: when -C is present the db in -d is used only to make the connection. | |
| # http://www.postgresql.org/docs/current/static/app-pgrestore.html | |
| # http://www.postgresql.org/docs/current/static/app-pgdump.html | |
| DATABASE_NAME=app_db |
| # Borrowed from this talk | |
| # https://www.youtube.com/watch?v=dBeXS5aFLNc | |
| # http://jberkus.github.io/performance_in_15_min/index.html?utm_source=postgresweekly&utm_medium=email#37 | |
| # Thank you Josh!! | |
| # Memory Settings | |
| shared_buffers = 2GB # RAM/4 up to 8GB | |
| work_mem = 32MB # limit: RAM/(max_connections/2) | |
| # 8MB to 32MB: web |
| require 'fileutils' | |
| class Encoder | |
| attr_reader :processed, :search_path, :queue | |
| def initialize | |
| @search_path = '/mnt/data/media' | |
| @processed = File.readlines('encode.log') if File.exists?('encode.log') | |
| @processed = Array(processed).map(&:chomp) | |
| @queue = Dir.glob("#{search_path}/**/*.avi").sort |
I hereby claim:
To claim this, I am signing this object: