Skip to content

Instantly share code, notes, and snippets.

@krzemienski
krzemienski / logging_subprocess.py
Created February 24, 2020 18:47 — forked from jaketame/logging_subprocess.py
Python subprocess logging to logger from stdout/stderr
#!/usr/local/bin/python3
import logging, select, subprocess
LOG_FILE = "test.log"
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO,filename=LOG_FILE,format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
def logging_call(popenargs, **kwargs):
process = subprocess.Popen(popenargs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
'''
As of zookeeper 3.4.0, the `mntr` admin command is provided for easy parsing of zookeeper stats.
This check first parses the `stat` admin command for a version number.
If the zookeeper version supports `mntr`, it is also parsed.
Duplicate information is being reported by both `mntr` and `stat` to keep backwards compatability.
@nmanzi
nmanzi / nexus.service
Last active January 5, 2018 14:05
Systemd script for Sonatype Nexus 2
[Unit]
Description=Nexus Service
After=network.target
[Service]
Type=forking
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
ExecReload=/opt/nexus/bin/nexus restart
PIDFile=/var/run/nexus/nexus.pid
@prasanthj
prasanthj / native-mem-tracking.md
Last active June 5, 2024 12:48
Native memory tracking in JVM

Enable native memory tracking in JVM by specifying the following flag

-XX:NativeMemoryTracking=detail

Know the <PID> of the java process

jps

To print ps based RSS

ps -p <PID> -o pcpu,rss,size,vsize

To print native memory tracking summary

@jpluimers
jpluimers / libssh2-build-steps.rst
Last active August 7, 2024 08:39
Building `libssh2` for Windows (Win32/Win64) is a lot harder than I hoped for
@myst3k
myst3k / after
Last active June 21, 2024 06:10
enable on boot nodemanager and adminserver weblogic 12c
#enable each service for boot
systemctl enable nodemanager
systemctl enable adminserver
#then reboot and test
@mozillazg
mozillazg / supervisord.service
Last active December 1, 2023 12:59 — forked from tonyseek/supervisord.service
install and configure supervisord on centos 7.
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown
[program:tomcat6]
command=/opt/tomcat6-instance/bin/supervisor-wrapper.sh