Getting a bundle state via script from Karaf 3.0.5 - apache-karaf

I can check a bundle state from Karaf Console by doing:-
karaf#root>bundle:list | grep camel-test
246 | Active | 50 | 2.16.1 | camel-test
Is there a way I can do this programatically via some script running on the same machine as Karaf or via some REST End Point that Karaf exposes?
I am using Karaf 3.0.5 running under ServiceMix 6.0.1.

As discussed in Karaf User Forum I am able to achieve it using the karaf client:-
jabong#jabong1143:~/Downloads/apache-servicemix-6.1.0/bin$ ./client -l 0 -u karaf "bundle:list" | grep camel-test
246 | Active | 50 | 2.16.1 | camel-test

Related

"spawn npm.cmd ENOENT" when running "amplify publish"

I have a simple React application with an Amplify configuration. When I try to publish it using Amplify (Mac) it ends with the following error:
❯ amplify publish
✔ Successfully pulled backend environment dev from the cloud.
Current Environment: dev
| Category | Resource name | Operation | Provider plugin |
| -------- | ---------------------------- | --------- | ----------------- |
| Api | sls-demo-twitter-state-api-2 | No Change | |
| Hosting | amplifyhosting | No Change | awscloudformation |
No changes detected
Publish started for amplifyhosting
command execution terminated with error
An error occurred during the publish operation: spawn npm.cmd ENOENT
The same configuration runs without any problems on my other client (Windows). Actually Amplify tries to build the app first and this step does not work. I cannot find reason for this.
"amplify publish" basically runs the build & start commands from amplify project configuration,
that you can reconfigure using amplify configure project.
I hope in your machine(Mac) npm is missing.
Install node brew install node and run amplify publish

mariadb server: I can't stop the server with `mysql.server stop`

OSX 10.13.6
I installed mariadb sever with homebrew a few years ago, and I use it infrequently. Today, I tried to start mariadb using the command:
$ mysql.server start
and I got a bunch of errors. So, I did:
$ brew update
then:
$ brew uprade mariadb
That completed fine, and now I can start mariadb with:
$ mysql.server start
and I can access all my old db's.
The problem I'm having is that I cannot stop mysql. Both these commands hang:
$ mysql.server stop
and(in another terminal window):
$ mysql.server status
According to the MariaDB docs for mysql.server, both those commands should work.
Currently, I'm killing the server like this:
$ killall mysqld mysqld_safe
then checking that the server was killed with this:
$ ps aux | grep mysqld
When I run the ps command when mysql is running, I get:
~$ ps aux | grep mysqld
7stud 3707 0.0 1.0 4808208 79948 s005 S 1:26PM 0:00.47
/usr/local/Cellar/mariadb/10.3.15/bin/mysqld
--basedir=/usr/local/Cellar/mariadb/10.3.15 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mariadb/10.3.15/lib/plugin --log-error=/usr/local/var/mysql/My-MacBook-Pro-2.local.err --pid-file=/usr/local/var/mysql/My-MacBook-Pro-2.local.pid
7stud 3643 0.0 0.0 4287792 1460 s005 S 1:26PM 0:00.02 /bin/sh
/usr/local/Cellar/mariadb/10.3.15/bin/mysqld_safe
--datadir=/usr/local/var/mysql --pid-file=/usr/local/var/mysql/My-MacBook-Pro-2.local.pid
7stud 4544 0.0 0.0 4267752 880 s000 S+ 1:41PM 0:00.00
grep mysqld
What is the proper way to shut down the mariadb server?
mysql> SHOW VARIABLES LIKE '%vers%';
+---------------------------------+------------------------------------------+
| Variable_name | Value |
+---------------------------------+------------------------------------------+
| innodb_version | 10.3.15 |
| protocol_version | 10 |
| slave_type_conversions | |
| system_versioning_alter_history | ERROR |
| system_versioning_asof | DEFAULT |
| thread_pool_oversubscribe | 3 |
| version | 10.3.15-MariaDB |
| version_comment | Homebrew |
| version_compile_machine | x86_64 |
| version_compile_os | osx10.13 |
| version_malloc_library | system |
| version_source_revision | 07aef9f7eb936de2b277f8ae209a1fd72510c011 |
| version_ssl_library | OpenSSL 1.0.2r 26 Feb 2019 |
| wsrep_patch_version | wsrep_25.24 |
+---------------------------------+------------------------------------------+
14 rows in set (0.01 sec)
I had the same issue, tried to use mysql.server stop and mysql.server status after running mysql.server start but they will just run indefinitely.
If you are using a Mac seems that mysql.server stop won't work... I installed mariadb with homebrew and found out that I can use brew services to start and stop it in this link:
https://dba.stackexchange.com/questions/214883/homebrew-mariadb-server-start-error-with-mysql-server-start
The commands are pretty simple and they work for me
brew services start mariadb
brew services stop mariadb
It may be a little late but I hope this helps you to figure out your problem.
See https://stackoverflow.com/a/59938033/4579271 for details.
To fix, run:
cp /usr/local/bin/mysql.server /usr/local/bin/mysql.server.backup
sed -i "" "s/user='mysql'/user=\`whoami\`/g" /usr/local/bin/mysql.server

Unix: Simple Command Knowledge

What does each token specify (in regards to docker) in the following command?
docker run --rm -it alpine chown nobody /
docker run --rm -it alpine chown nobody /
| | || | | |
| | | ------ ------------
| | | | |
Start running a container
| | | |
Delete the container when it's finished running
| | |
Interactive mode, attach to your terminal's stdin
| |
Tag. Runs container tagged `alpine`
|
Run `chown nobody /` inside container
Note that the command chown nobody / won't do anything because the changes are lost as soon as the container exits.
By running docker run --help you will see all the options and their meaning:
-i, --interactive Keep STDIN open even if not attached
--rm Automatically remove the container
when it exits
As for the chown nobody /, this command runs on container startup.
This command will change the owner of root dir (which is aliased by /) to user nobody. The user nobody is a special user available in linux distributions.

Flyway database migration tool info option not printing the version number

WE have flyway integrated with Redshift and we are using this as a simple java main program to run all our schema migrations. We also use the info command to print the current version of the database, However this command successfully runs or at least appears to run but does not print the version number.
We have version 4.2 of the flyway jar. What is that we may be missing? Thanks
To manually recreate what the info command line option does in java code you can copy what its implementation does (from the source):
MigrationInfoDumper.dumpToAsciiTable(flyway.info().all())
An example from the docs is shown below:
+-------------+------------------------+---------------------+---------+
| Version | Description | Installed on | State |
+-------------+------------------------+---------------------+---------+
| 1 | Initial structure | | Pending |
| 1.1 | Populate table | | Pending |
| 1.3 | And his brother | | Pending |
+-------------+------------------------+---------------------+---------+

How to restart ceilometer service

I changed pulling intervals in /etc/ceilometer/pipeline.yaml file from 600 to 60 and can't make the service to use new values. I restarted everything that relates to ceilometer in openstack-status command, but that did not work. Can somebody tell me the proper way how to do it?
I am using Openstack Liberty on Ubuntu 14.04 LTS
root#OS1:~# openstack service list
+----------------------------------+------------+---------------+
| ID | Name | Type |
+----------------------------------+------------+---------------+
| 056fcccaad5c4991a8a0da199ed1d737 | cinderv2 | volumev2 |
| 483a0cd1ba79430690a8960ae3d40222 | glance | image |
| 5c704fc9253e4c15895589eb19fab2ac | keystone | identity |
| 92bfcfb417314e80a43e6e7d4d21f99b | nova | compute |
| a7a3809d73674d3da3fbe8030b47055a | horizon | dashboard |
| c21b5e3c9d68417cb11df60d72f9bb58 | heat | orchestration |
| c7030edb082346328a715b00098b974a | neutron | network |
| d331f5360e2b4d3a854e7f47107a9421 | ec2 | ec2 |
| f0a22f827bed43dbbc43822abfc3e3e0 | ceilometer | metering |
+----------------------------------+------------+---------------+
root#OS11:~# openstack-status
.
.
.
== Ceilometer services ==
ceilometer-api: active
ceilometer-agent-central: active
ceilometer-agent-compute: inactive (disabled on boot)
ceilometer-collector: active
ceilometer-alarm-notifier: active
ceilometer-alarm-evaluator: active
ceilometer-agent-notification:active
.
.
.
Well, you need to restart ceilometer-agent-notification service because this service is responsible for transforming the data into samples in the ceilometer database.
Thus, systemctl restart ceilometer-agent-notification.service will help along with restarting other services.
Since ceilometer-agent-compute service is disabled, you just need to restart ceilometer-agent-central service on the node you have modified the config file.
sudo service ceilometer-agent-central restart
You might want to auto reload pipelines after you modify it, for that, you can set refresh_pipeline_cfg=True and a proper time for pipeline_polling_interval such as 120 seconds in /etc/ceilometer/ceilometer.conf.
Note, be careful when you enable auto reload, and only save pipeline config file after you are sure about the content is right (otherwise it might lose 1 polling period data)

Resources