Postgres initdb: How to set logging_collector=on in the generated postgressql.conf file - postgresql

The default postgresql.conf file created using initdb contains the following line
#logging_collector = off # Enable capturing of stderr and csvlog
Is there anyway to force initdb itself to generate a file with
logging_collector = on
rather than set options on pg-ctl or edit the generated file.

I keep all the changes in a separate file named custom.conf
Then after initdb ran, I copy the file to the data directory and append an include directive to postgresql.conf:
cp /path/to/dir/custom.conf $PGDATA
echo include = 'custom.conf' >> $PGDATA/postgresql.conf
These steps are easily scriptable, so no manual intervention required.
Alternatively you can skip the copy step and include the config file directly from the central directory. Or you could use include_dir to include the whole directory where your custom config file is stored.
This has the added benefit (in my opinion) that I have all customizations in a single file. I don't need to go through postgresql.conf to find settings that are changed from the default.

No, there is no way to do it like that.
But you can modify the file postgresql.conf.sample in the “share” directory of the PostgreSQL installation, which is used as the blueprint for postgresql.conf during initdb.

Related

Yocto: add a statement in the default service file within a recipe

I'd need to add a Restart statement within a default .service file, and was looking to an alternate solution to replacing the .service file with a custom one (which works).
The idea would be just adding the following "delta" requirement in a, e.g., ${systemd_system_unitdir}/my_service.d/override.conf file:
[Service]
Restart=always
and then adding that file in a dedicated .bbappend recipe file.
Tests so far were not successful in adding the above statements in the deployed service file (despite the "delta" conf file being correctly deployed). Is this even a possible solution?
You should be able to do that simply by echoing that entry in a do_install:append() section in you .bbappend file. Something like:
do_install:append() {
echo "[Service]\nRestart=always" >> ${D}${sysconfdir}/wpa_supplicant/...
}
You can equally use sed to find and replace that section if there is already a file inplace.
${sysconfdir} will expanded to /etc. Check this file for more defined path variables: https://git.yoctoproject.org/poky/plain/meta/conf/bitbake.conf?h=blinky

Set custom postgres pid and log file

I tried to set up new configs for my postgres, but for some reason I can't do it correctly.
First of my trying is to move .pid file to some other location, I can rename the file in postgres.conf but I can't set it to directory I need.
Same situation is with .log file.
Why when I tried to set pid file using external_pid_file = '/home/vagrant/shared/pids/postgres.pid' file isn't created? Or when I tried to set log file to /home/vagrant/shared/logs folder I have the same issue.
My config file:
https://pastebin.com/ud6HSJrn

install4j: Installation doesnt create an alternativeLogfile

When i Invoke the installer with:
installerchecker_windows-x64_19_2_1_0-SNAPSHOT.exe
-q
-c
-varfile install.varfile
-Dinstall4j.alternativeLogfile=d:/tmp/logs/installchecker.log
-Dinstall4j.logToStderr=true
it creates and writes the standard log file installation.log in the .install4j Directory, but doesnt create my custom log in d:/tmp/logs. As configured there is an additional error.log with the correct content.
The installation.log shows the comand-line config : install4j.alternativeLogfile=d:/tmp/logs/installchecker.log
The Directory d:/tmp/logs has full access.
Where is the failure in my config ?
The alternative log file is intended to debug situations where the installer fails. To avoid moving the log file to its final destination in .install4j/installation.log, the VM parameter
-Dinstall4j.noPermanentLogFile=true
can be specified.

How to create temporary files `.#filename` in `/tmp`, not working directory

When files are being modified in Emacs, a temporary file is created in the working directory that looks like this: .#filename. The file is deleted when the buffer is saved.
I found a few of these types of temporary files in my Git remote repositories, and I thought it might be better to nip the bud at the source instead of configuring Git to ignore them for every project.
How can we configure Emacs to create those files in the /tmp directory instead of the working directory?
The file at issue is called a lock file -- commencing with Emacs version 24.3, it can be controlled with the following setting:
(setq create-lockfiles nil)
https://stackoverflow.com/a/12974060/2112489
These files are auto-save files. The variable auto-save-file-name-transforms controls what modifications to make to the buffer's file name to generate the auto save file name. Usually, the default in file.el will suffice to put all the auto save files in the /tmp directory. It's default value is:
(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" "/tmp/\\2" t))
That /tmp comes by reading the variable temporary-file-directory. Check that value so that it points to /tmp. Then, the value constructed for auto-save-file-name-transforms (and hence for the auto save file name) will be correct.
As a more general solution, you could also make a global exclude file, which applies to all repositories locally. By default, this will be in $XDG_CONFIG_HOME/git/ignore (usually ~/.config/git/ignore). The path can be overridden using the core.excludesFile option. See the gitignore manpage for more details.
$ mkdir -p ~/.config/git
$ echo '.#*' >> ~/.config/git/ignore

psql: Init files?

In the psql documentation, I read information about variables (section advanced features), e.g. one of these variables is:
HISTSIZE
The number of commands to store in the command history. The default value is 500.
Is there a file in the home directory or somewhere else where I can configure these variables?
What syntax would I use in that file?
If you look at the Files section, you'll see this:
Files
Unless it is passed an -X or -c option, psql attempts to read and execute commands from the system-wide psqlrc file and the user's ~/.psqlrc file before starting up. (On Windows, the user's startup file is named %APPDATA%\postgresql\psqlrc.conf.) See PREFIX/share/psqlrc.sample for information on setting up the system-wide file. It could be used to set up the client or the server to taste (using the \set and SET commands).
The location of the user's ~/.psqlrc file can also be set explicitly via the PSQLRC environment setting.
So like most Unix commands, there is an RC ("Run Commands") file that you can use for configuration, the name also matches the Unix conventions of ~/.cmdrc so you want ~/.psqlrc.
The format matches the \set commands you'd use within psql itself:
\set HISTSIZE 11
for example.