Update nginx configuration file using a script - nginx

Input:
I want to write a script name nginx-conf-update.sh.
when is run
$./nginx-conf-update.sh 3
Output:

Related

Fluentbit Multiple Config Files Setup is not working

I am using multiple conf files inside my main conf file. However, the service is constantly taking on the first conf file.
Below is my main conf file code,
#INCLUDE fluent-bit-for-application-info-log.conf
#INCLUDE fluent-bit-for-application.conf
I have tested with different orders but every time it is constantly picking up only the first line.
[SERVICE]
flush 1
log_level debug
parsers_file parsers.conf
plugins_file plugins.conf
storage.metrics on
[INPUT]
name tail
path D:\xxxx\**\*.log
parser iis
Multiline Off
Skip_Empty_Lines On
refresh_interval 10
Tag iis_log
[OUTPUT]
Name s3
Match iis_log
Bucket xxxx
region ap-xx-1
s3_key_format /xxxx/xxxxx/%Y/%m/%d/%H/$UUID.log
Is there any additional config we need to add to process all config files?
Note: All my config files have the same code except path, bucket and tag details.
Please let me know if you need any information.
Thanks in Advance.

Error building webpage: RStudio + blogdown + Ezhil Theme

I am new to blogdown/hugo themes and want to build a webpage using the Ezhil theme with RStudio. I am following the instructions of blogdown.
In particular, after creating the project on RStudio, I am not able to build/serve the site. If I run serve_site(), I obtain
> blogdown::serve_site()
Launching the server via the command:
/Users/brunoconteleite/Library/Application Support/Hugo/0.84.2/hugo server --bind 127.0.0.1 -p 4321 --themesDir themes -t ezhil -D -F --navigateToChanged
Error: Error building site: logged 1 error(s)
Instead, if I run hugo_build(), I obtain
> blogdown::hugo_build()
Start building sites …
hugo v0.84.2-E0C67958+extended darwin/amd64 BuildDate=2021-06-28T10:59:21Z VendorInfo=gohugoio
ERROR 2021/06/29 13:20:37 instagram shortcode: Missing config value for services.instagram.accessToken. This can be set in config.toml, but it is recommended to configure this via the HUGO_SERVICES_INSTAGRAM_ACCESSTOKEN OS environment variable. If you are using a Client Access Token, remember that you must combine it with your App ID using a pipe symbol (<APPID>|<CLIENTTOKEN>) otherwise the request will fail.
If you feel that this should not be logged as an ERROR, you can ignore it by adding this to your site config:
ignoreErrors = ["error-missing-instagram-accesstoken"]
Total in 40 ms
Error: Error building site: logged 1 error(s)
I tried to add the suggested ignoreErrors = ["error-missing-instagram-accesstoken"] line of code to the config.yalm file but could not address this issue.
You need to turn the TOML code into YAML if your config file has yaml or yml extension.
So, rather than ignoreErrors = ["error-missing-instagram-accesstoken"], add ignoreErrors: "error-missing-instagram-accesstoken" line to your config.yaml file. It should work.

Flywaydb multiple config files for migration is failing

We have tried to migrate some SQL versions in a single database and it went well. When to tried to implement the migrations for multiple databases at the same time by passing multiple config files is failing.
The issue is it takes only the last config file and the migration is performed only for the database mentioned in the last config file, when passed the multiple config files in "-configFiles" parameter.
Below is the screenshot of the same, it took only flywayconfdb.conf file and left other files.
[oracle#localhost flyway-5.1.4]$ ./flyway -configFiles=/home/oracle/flyway/flyway-5.1.4/conf/flyway.conf,/home/oracle/flyway/flyway-5.1.4/conf/flywayjiradb.conf,/home/oracle/flyway/flyway-5.1.4/conf/flywayconfdb.conf info
Flyway Community Edition 5.1.4 by Boxfuse
Database: jdbc:oracle:thin:#//XXXXXXXXX:1521/confdb (Oracle 12.2)
Schema version: << Empty Schema >>
+----------+---------+-------------+------+--------------+-------+
| Category | Version | Description | Type | Installed On | State |
+----------+---------+-------------+------+--------------+-------+
| No migrations found |
+----------+---------+-------------+------+--------------+-------+
Please help us in resolving the same.
Flyway merges the config files. It doesn't do a separate migration for each one.
For each config file, Flyway adds the content to a Properties map. Properties has only one value per key, so if the same key appears in a second config file it would overwrite the previous value. This is why it seems like just the settings from the last config file are used.
It allows you to define some common settings somewhere, for example in ~/flyway.conf, which could be merged with some more specific settings, e.g. in individual projects.
But it doesn't allow you to migrate multiple databases in a single run. You need to run Flyway once per database:
./flyway -configFiles=/home/oracle/flyway/flyway-5.1.4/conf/flywayjiradb.conf info
./flyway -configFiles=/home/oracle/flyway/flyway-5.1.4/conf/flywayconfdb.conf info
The documentation describes the Overriding Order as:
Command-line arguments
Environment variables
Custom config files
<current-dir>/flyway.conf
<user-home>/flyway.conf
<install-dir>/conf/flyway.conf
Flyway command-line defaults
With settings defined higher up the list having greater precedence.
The documentation gives the following example:
The means that if for example flyway.url is both present in a config
file and passed as -url= from the command-line, the command-line
argument will take precedence and be used.
The Custom config files (-configFiles) lines could be expanded as:
Command-line arguments
Environment variables
Custom config file n
...
Custom config file 2
Custom config file 1
<current-dir>/flyway.conf
<user-home>/flyway.conf
<install-dir>/conf/flyway.conf
Flyway command-line defaults
And a corresponding example could be:
The means that if for example flyway.url is both present in custom config file 1 and custom config file 2, the custom config file 2 settings will take precedence and be used.
Similarly, if the flyway.url was also in custom config file n that would override that setting from custom config file 2.

Passing environment variables to a UNIX Script from an AutoSys JIL script

JIL script allows the passing of envvars to a command as below.
My question is how to specify the envars in a file on the file system rather than in the JIL script?
insert_job: unix_job
job_type: CMD
machine: unixprod
command: /home/scripts/pay
envvars: NAME="user 1"
envvars: JOB=PAYROLL
envvars: PWD=/usr/scripts/dailyrun
Set a profile attribute in your JIL that points to a script file which loads your environment variables.
profile: /your/path/here/config.ksh
Inside config.ksh:
#!/usr/bin/ksh
export NAME="user 1"
export JOB=PAYROLL
export PWD=/usr/scripts/dailyrun

Workflow: Email contents of file

I have a bunch of pig scripts that I'm running as a workflow in oozie. Some of the output files are very short and there are a couple I'd like to concatenate and include in the body of an email action. How would I go about doing this?
Use action and send an email from a script.
workflow.xml :
...
<shell>
<exec>email_hdfs_file.sh</exec>
<file>scripts/email_hdfs_file.sh</exec>
</shell>
...
Make sure you have scripts/email_hdfs_file.sh in the same folder in hdfs.
email_hdfs_file.sh :
#1 download and merge multiple files into one
hadoop fs -getmerge /path/to/your/files part-all.txt
#2 put a command that emails part-all.txt file here
It's up to you how to implement #2

Resources