ActiveMQ execution failing on IBM i - activemq

Has anyone installed/run ActiveMQ on IBM i and can help me with this?
Either the process does not run or gives ZipException.
I downloaded ActiveMQ 5.16.2 from ActiveMQ 5.16.2 (Apr 28, 2021) - Unix/Linux/Cygwin bundle
for installing on IBMi V7R3 and followed the official steps for installation mentioned on Version 5 Getting Started - 'Installation Procedure for Unix' section.
This is similar to installing on IBMi as mentioned in - Installing activeMQ on IBM i5 V5R4
On running the command ./bin/activemq start, the process starts but ends without actually running ActiveMq.
It shows below error on the console -
./bin/activemq: 001-0019 Error found searching for command whoami. No such path or directory.
Also the command ./bin/activemq status returns ActiveMQ not running .
When running the command ./bin/activemq console, the process starts but gives the same whoami error and ends with ZipException.
On Windows, I have been able to install and run successfully.
Has anyone installed ActiveMQ on IBMi and can help me with this?

You are missing the command
whoami
This is not a shell built-in, so you would need to add that package to your installation.
h/t to #nfgl for the pointer to the IBM OSS rpm repo. If you inspect their src.rpm, you'll see they patch the activemq script. Worth reviewing
SRC RPM calls for this dependency: coreutils-gnu
IBM iSeries Patch of bin/activemq:
$ more activemq-activemq.patch
--- a/bin/activemq 2020-03-30 18:50:50.000000000 +0000
+++ b/bin/activemq 2020-03-30 18:57:03.000000000 +0000
## -336,10 +336,14 ##
-Dactivemq.data=\"${ACTIVEMQ_DATA}\" \
$ACTIVEMQ_CYGWIN \
-jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS >> $ACTIVEMQ_OUT 2>&1 &
- RET=\"\$?\"; APID=\"\$!\";
- echo \$APID > "${PIDFILE}";
- echo \"INFO: pidfile created : '${PIDFILE}' (pid '\$APID')\";exit \$RET" $DOIT_POSTFIX
- RET="$?"
+ exit \"\$?\"" $DOIT_POSTFIX
+ RET="$?"
+ sleep 5
+ OS400_PID=`ps | grep -iE 'java|jFromPASE|jvmStartPase|qp0zspwp' | grep -v '\spgm-' | grep -vE '^\s+1\s' | tail -n 1 | awk '{print $1}'`
+ rm -f $PIDFILE
+ qsh -c "/usr/bin/touch -C 1208 $PIDFILE"
+ echo $OS400_PID > $PIDFILE
+ echo "INFO: pidfile created : '$PIDFILE' (pid '$OS400_PID')"
elif [ -n "$TASK_TODO" ] && [ "$TASK_TODO" = "stop" ];then
SPID="`cat "${PIDFILE}"`"
$EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
## -384,7 +388,7 ##
return 2
fi
ACTIVEMQ_PID="`cat ${ACTIVEMQ_PIDFILE}`"
- RET="`ps -p "${ACTIVEMQ_PID}"|grep java`"
+ RET=`/QOpenSys/usr/bin/ps -p ${ACTIVEMQ_PID}|grep -iE 'java|jFromPASE|jvmStartPase'`
if [ -n "$RET" ];then
return 0;
else
## -403,7 +407,7 ##
return 2
fi
THEPID=`cat ${PID_STOP}`
- RET=`ps -p $THEPID|grep java`
+ RET=`/QOpenSys/usr/bin/ps -p ${ACTIVEMQ_PID}|grep -iE 'java|jFromPASE|jvmStartPase'`
if [ -n "$RET" ];then
return 0;
else

Related

CentOS 8 Cgroup (or v2) installation without CWP

We are trying to install cgroup v2 to our centOS 8 virtual servers but after all configs we can limit memory bu we can't limit cpu. We can't see the cpu.max (sys/fs/cgroup/user.slice)
Has cgroup v2 got full support on CentOS 8 ? , we don't have any idea on this. (We must use centOS 8 , can't be Rhel 8)
Do you have any idea or solution about how cgroup V2 works on CentOS 8 without CWP ?
Thank You for All
##https://www.redhat.com/en/authors/marc-richter
#https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/pdf/managing_monitoring_and_updating_the_kernel/Red_Hat_Enterprise_Linux-8-Managing_monitoring_and_updating_the_kernel-en-US.pdf
GRUB
grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="cgroup_no_v1=all"
reboot
/usr/bin/configure_cgroups.sh
#!/bin/bash
touch /var/tmp/configure_cgroups.sh.ok
mkdir -p /mnt/cgroupv2
if [ ! -f /mnt/cgroupv2/cgroup.subtree_control ]
then
mount -t cgroup2 none /mnt/cgroupv2
echo "+cpu" > /mnt/cgroupv2/cgroup.subtree_control
echo "+cpuset" > /mnt/cgroupv2/cgroup.subtree_control
echo "+memory" > /mnt/cgroupv2/cgroup.subtree_control
fi
##cpuNo=0
numberfCpus=$(nproc --all)
numberOfUsers=$(ls /home| wc -l)
cpuShare=$((numberfCpus*100000/numberOfUsers))
totalMemory=$(cat /proc/meminfo | grep MemTotal| awk '{print $2}')
memoryShare=$((totalMemory/numberOfUsers*1024))
for username in $(ls /home)
do
if [ ! -d /mnt/cgroupv2/user.$username ]
then
mkdir -p /mnt/cgroupv2/user.$username
##echo "$cpuNo" > /mnt/cgroupv2/user.$username/cpuset.cpus
##echo "$cpuNo" > /mnt/cgroupv2/user.$username/cpuset.mems
echo "$cpuShare 100000" > /mnt/cgroupv2/user.$username/cpu.max
echo "$memoryShare" > /mnt/cgroupv2/user.$username/memory.max
##cpuNo=$((cpuNo+1))
fi
done
for username in $(ls /home)
do
for pid in $(ps -ef | grep -i "^$username" | awk '{print $2}')
do
grep $pid /mnt/cgroupv2/user.$username/cgroup.procs >/dev/null
if [ $? != 0 ]
then
echo $pid > /mnt/cgroupv2/user.$username/cgroup.procs
fi
done
done
SERVICE : /usr/lib/systemd/system/configure-cgroupsv2.service
[Unit]
Description=Configure CGroups V2
[Service]
Type=oneshot
ExecStart=/usr/bin/configure_cgroups.sh
SERVICE : /usr/lib/systemd/system/configure-cgroupsv2.timer
[Unit]
Description=Configure CGroups V2 Timer
[Timer]
OnUnitActiveSec=10s
OnBootSec=10s
[Install]
WantedBy=timers.target
systemctl daemon-reload
systemctl enable configure-cgroupsv2.timer
systemctl start configure-cgroupsv2.timer
systemctl list-timers --all| grep configure
systemctl start configure-cgroupsv2.service
systemctl status configure-cgroupsv2.service
journalctl -xe
Testing :
CPU: "while true; do echo > /dev/null; done" then top
RAM : "cat /dev/zero | head -c 20000M | tail " then top
Also , you must do the following to be able to run your docker images :
1. yum install crun -y
2. cp /usr/share/containers/containers.conf /etc/containers/
3. edit /etc/containers/containers.conf
cgroups="disabled"
runtime="crun"

cannot kill process in FreeBSD

I have a script in FreeBSD 10.1 release, it's purpose is to monitor another process and keep the process alive.
When I try to kill itself, it always fail.
I try killall [name | pid]; pkill -9 [name]; service watchtas stop, none of them work.
Below is my script, please advise the solution.
#!/bin/sh
. /etc/rc.subr
prog="Thin-Agent WatchDog"
TAS_BIN="/etc/supermicro/tas-freebsd.x86_64"
TAS_LOG="/etc/supermicro/tas_system_crush.log"
monitor=1
name="watchtas"
rcvar=${name}_enable
command=/etc/rc.d/{$name}
start_cmd="watchdog"
stop_cmd="stop_watching"
load_rc_config $name
recover_tas() {
$TAS_BIN -agent start-service
RETVAl=$?
return $RETVAL
}
stop_watching() {
monitor=0
}
watchdog() {
while [ $monitor == 1 ]
do
tas_count=`ps -x | grep tas-freebsd.x86_64 | grep -v grep | wc -l | sed 's/ *//g'`
if [ $tas_count -eq 0 ]; then
timestamp=`date`
echo "[$timestamp]TAS shutdown unexpectedly, restarting TAS now..." >> $TAS_LOG
echo $?
recover_tas
else
sleep 10
fi
done
}
run_rc_command "$1"
Your start-up script fails in a couple of respects. service watchtas start does not return to the command line because the daemon process does not detach. service watchtas stop does not work as required because the variable monitor is local to the executing script.
I would separate the start-up script and the watchdog code into separate files and use daemon(8) to monitor the watchdog.
The /usr/local/etc/rc.d start-up script would look like this:
#!/bin/sh
. /etc/rc.subr
name="watchtas"
rcvar=${name}_enable
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
command_args="-c -f -P ${pidfile} -r /usr/local/sbin/${name}"
load_rc_config $name
run_rc_command "$1"
The /usr/local/sbin/watchtas watchdog code would look something like this:
#!/bin/sh
TAS_BIN="/etc/supermicro/tas-freebsd.x86_64"
TAS_LOG="/etc/supermicro/tas_system_crush.log"
recover_tas() {
$TAS_BIN -agent start-service
RETVAl=$?
return $RETVAL
}
while true
do
tas_count=`ps -x | grep tas-freebsd.x86_64 | grep -v grep | wc -l | sed 's/ *//g'`
if [ $tas_count -eq 0 ]; then
timestamp=`date`
echo "[$timestamp]TAS shutdown unexpectedly, restarting TAS now..." >> $TAS_LOG
echo $?
recover_tas
else
sleep 10
fi
done
It seems you have a daemon watching a daemon watching a daemon.

lxc create unprivileged containers

I've installed lxc for create containers and I've done the commands for create unprivileged containers but I've this errors when I do:
[andrea#andrea lxc]$ lxc-create -t download -n prova0
lxc-create: conf.c: chown_mapped_root: 3406 No mapping for container root
lxc-create: lxccontainer.c: do_bdev_create: 943 Error chowning /home/andrea/.local/share/lxc/prova0/rootfs to container root
lxc-create: conf.c: suggest_default_idmap: 4444 Your system is not configured with subuids
lxc-create: lxccontainer.c: do_lxcapi_create: 1408 Error creating backing store type (none) for prova0
lxc-create: lxc_create.c: main: 274 Error creating container prova0
lxc-create: ... Your system is not configured with subuids
As per the above error message, it sounds like you're trying to create an unprivileged container without subuids configured. These steps are for Ubuntu 14.04, but I suspect they will work on Fedora as well.
$ mkdir -p ~/.config/lxc
$ echo "lxc.id_map = u 0 100000 65536" > ~/.config/lxc/default.conf
$ echo "lxc.id_map = g 0 100000 65536" >> ~/.config/lxc/default.conf
$ echo "lxc.network.type = veth" >> ~/.config/lxc/default.conf
$ echo "lxc.network.link = lxcbr0" >> ~/.config/lxc/default.conf
$ echo "$USER veth lxcbr0 2" | sudo tee -a /etc/lxc/lxc-usernet
Once these are configured, you should be able to create an ubuntu container, as follows:
$ lxc-create -t download -n u1 -- -d ubuntu -r trusty -a amd64
Taken from the Ubuntu Server LXC guide:
https://help.ubuntu.com/lts/serverguide/lxc.html#lxc-unpriv

JBoss As 7 service on Ubuntu 12.04

I'm having trouble starting the JBoss 7 version 7.1.1 Final on Ubuntu 12.04
Jboss put in /usr/share/jboss.
The script was placed below /etc/init.d/jboss.
#!/bin/bash### BEGIN INIT INFO
# Provides: jbossas7
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop JBoss AS 7
### END INIT INFO
# chkconfig: 35 92 1
## Include some script files in order to set and export environmental variables
## as well as add the appropriate executables to $PATH.
[ -r /etc/profile.d/java.sh ] && . /etc/profile.d/java.sh
[ -r /etc/profile.d/jboss.sh ] && . /etc/profile.d/jboss.sh
JBOSS_HOME=/usr/share/jboss
AS7_OPTS="$AS7_OPTS -Dorg.apache.tomcat.util.http.ServerCookie.ALLOW_HTTP_SEPARATORS_IN_V0=tr$
AS7_OPTS="$AS7_OPTS -Djboss.bind.address.management=54.232.246.186"
AS7_OPTS="$AS7_OPTS -Djboss.bind.address=54.232.246.186"
case "$1" in
start)
echo "Starting JBoss AS 7..."
sudo -u jboss sh ${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS ## If running a$
start-stop-daemon --start --quiet --background --chuid jboss --exec ${JBOSS_HOME}/bin$
${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS &
;;
stop)
echo "Stopping JBoss AS 7..."
sudo -u jboss sh ${JBOSS_HOME}/bin/jboss-admin.sh --connect command=:shutdown $
start-stop-daemon --start --quiet --background --chuid jboss --exec ${JBOSS_HOME}/bin$
${JBOSS_HOME}/bin/jboss-cli.sh --connect command=:shutdown
;;
*)
echo "Usage: /etc/init.d/jbossas7 {start|stop}"; exit 1;
;;
esac
exit 0
I followed the examples presented in the following sites:
How to Install Jboss AS 7 as a Linux service
Run JBoss service HowTo
But when I run: sudo service jboss start
I get the following message: boss: unrecognized service
You must make the script
/etc/init.d/jboss
executable by following command:
sudo chmod +x /etc/init.d/jboss

Mixed Mode RVM giving error when used in init script

I've installed RVM in Mixed Mode and have Phusion Passenger running in stand alone mode.
I've found this init script to start my Phusion Passenger standalone server on startup: http://memcloud.com/note/show/167
Modifying only the prescribed values, it was giving me the following error, but would still run
-su: /home/myuser/.rvm/bin/rvm: No such file or directory
I ran which rvm in myuser and found out that RVM is in /usr/local/rvm/bin/rvm. So I updated the RVM variable to reflect that, and changed RVM="$USER_HOME/.rvm/bin/rvm" to RVM="/usr/local/rvm/bin/rv". Now it's giving me the following message, but it still runs.
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
Not really sure if it's a problem if the system is running, but I'd just like to be sure.
I would say this script is wrong, you should use something more like this:
#!/usr/bin/env bash
### BEGIN INIT INFO
# Provides: my-app passenger in standalone
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop my-app web site
### END INIT INFO
# BEGIN MINIMAL CHANGES
USER=www-data
USER_HOME=/var/www
APP_PATH=/var/www/my-app/current
GEM_SET=ruby-1.8.7-p330#my-app
ADDRESS=127.0.0.1
PORT=3000
ENVIRONMENT=production
# END MINIMAL CHANGES
RVM="/usr/local/rvm/bin/rvm"
PASSENGER="$USER_HOME/.rvm/gems/$GEM_SET/bin/passenger"
PASSENGER="cd $APP_PATH; $RVM $GEM_SET do $PASSENGER"
CMD_START="$PASSENGER start -a $ADDRESS -p $PORT -e $ENVIRONMENT -d"
CMD_STOP="$PASSENGER stop -p $PORT"
. /lib/lsb/init-functions
case "$1" in
start)
echo "Starting myapp passenger"
echo $CMD_START
su - $USER -c "$CMD_START"
;;
stop)
echo "Stopping myapp passenger"
echo $CMD_STOP
su - $USER -c "$CMD_STOP"
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
you could also replace GEM_SET=. to make rvm use ruby stored in .rvmrc but this requires that $USER trusted that .rvmrc ... which could be also done in this script with:
su - $USER -c "rvm rvmrc trust $APP_PATH"
called as first line in start)