postgres-initial-linux-configuration-guide.webp

Postgres Initial Linux Configuration Guide

Accessing psql sudo -i -u postgres psql Create a new database and user Create a new user: CREATE USER theusername WITH PASSWORD 'thepassword'; Create a new database: CREATE DATABASE thedatabase; Grant privileges: GRANT ALL PRIVILEGES ON DATABASE thedatabase TO theusername; Allow Remote Access Edit postgresql.conf, usually located in /etc/postgresql/<version>/main/, and set listen_addresses = '*'. #------------------------------------------------------------------------------ # CONNECTIONS AND AUTHENTICATION #------------------------------------------------------------------------------ # - Connection Settings - listen_addresses = '*' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost'; use '*' for all # (change requires restart) port = 5432 # (change requires restart) max_connections = 100 # (change requires restart) #reserved_connections = 0 # (change requires restart) #superuser_reserved_connections = 3 # (change requires restart) unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories # (change requires restart) #unix_socket_group = '' # (change requires restart) #unix_socket_permissions = 0777 # begin with 0 to use octal notation # (change requires restart) #bonjour = off # advertise server via Bonjour # (change requires restart) #bonjour_name = '' # defaults to the computer name # (change requires restart) # - TCP settings - # see "man tcp" for details #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; # 0 selects the system default #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; # 0 selects the system default #tcp_keepalives_count = 0 # TCP_KEEPCNT; # 0 selects the system default #tcp_user_timeout = 0 # TCP_USER_TIMEOUT, in milliseconds; # 0 selects the system default #client_connection_check_interval = 0 # time between checks for client # disconnection while running queries; # 0 for never Edit pg_hba.conf and add a line to allow connections — for example, host all all 0.0.0.0/0 scram-sha-256 — for network access. ...

April 5, 2026 · John Pili
bash-string-manipulation-in-program-arguments.webp

Bash string manipulation in program arguments

In this code snippet, I would like to run an application with a URL payload based on date and time. This code will be executed in a specific schedule everyday and I would like to dynamically inject the date and time in the program argument when the program executes. ./json2csv rules.json "ncp" "http://localhost:8080/api/zget?eid=get-ncp-mv-by-starttime-endtime&starttime;=$(date --date='yesterday' +\%Y-\%m-\%d)+00:00:00&endtime;=$(date --date='yesterday' +\%Y-\%m-\%d)+23:59:00&container;=false" > $(echo "nercc_mv_$(date --date='yesterday' +\%Y-\%m-\%d).csv") The way to do this is using the Bash String Manipulation Inside a string, the bash will evaluate statement inside “$()” in this example: ...

December 27, 2025 · John Pili
Linux systemd entry for your Go application

Linux systemd entry for your Go application

Systemd is a Linux software suite that handles system services (daemon) and timers; it enables you to start, stop and restart your application using systemctl command. It can also start your application during operating systems boot-up sequence. Note that you will need to have root or sudo privileges for this operation. To create a systemd unit file, create a service file inside the directory /etc/systemd/system/. The filename must end with .service for example: ...

January 4, 2021 · John Pili