This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PIDS='1234 5678' | |
for PID in $PIDS; do | |
echo "----- PID $PID -----" | |
cat /proc/$PID/limits | |
lsof -a -d 1-999999 -p $PID | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yum install gperftools-libs | |
Loaded plugins: fastestmirror | |
Loading mirror speeds from cached hostfile | |
* base: mirror.nl.leaseweb.net | |
* epel: ftp.fau.de | |
* extras: mirror.proserve.nl | |
* updates: mirror.proserve.nl | |
Resolving Dependencies | |
--> Running transaction check | |
---> Package gperftools-libs.x86_64 0:2.4-5.el7 will be installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'uri' | |
i = 0 | |
while true | |
begin | |
i += 1 | |
puts "#{Time.now}: Pinging #{i}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var server = http.createServer(function(req, res) { | |
res.writeHead(200, { 'Content-Type': 'text/plain' }); | |
res.end('hello world'); | |
}); | |
server.listen(3000); | |
if (typeof PhusionPassenger !== 'undefined') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# De toplevel module is UnionStationHooks. Maar het heeft ook een alias. | |
version = UnionStationHooks::VERSION_STRING | |
version = USH::VERSION_STRING # hetzelfde | |
# Initialization. Passenger roept dit aan aan het begin van een request. | |
reporter = UnionStationHooks.begin_request(rack_env) | |
# Een Reporter object is een high-level object om *request-specifieke* | |
# informatie te versturen naar Union Station. De applicatie kan het | |
# object als volgt verkrijgen: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch { | |
// The following line triggers this compiler error: | |
// input.ch <- websocketReadResult literal used as value | |
case input.ch <- websocketReadResult{ messageType, p, nil }: | |
// Do nothing | |
case <- input.cancel: | |
conn.abortWriterFromReaderProcess() | |
break | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 -u | |
# This shell script simulates a CGI web server. | |
# Save as 'testprocess.py' and run with: | |
# docker run -i --rm ubuntu:14.04 python3 -u < testprocess.py | |
import os, signal, time | |
# The web server spawns a CGI script, which in turn spawns a long-running 'grep', | |
# simulated here by 'sleep 999'. | |
print("Spawning CGI script") | |
pid = os.fork() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the plan: | |
1. Launch server #1 | |
2. Launch server #2 | |
3. Launch server #3 | |
4. Create master database instance #1 on server #1 | |
5. Create slave database instance #2 on server #2 | |
6. Create slave database instance #3 on server #3 | |
Continue with this plan? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the plan: | |
1. Promote slave instance #2 (on server 192.168.0.2) to master | |
2. Forward port 7000 in the entire cluster to slave instance #2 (on server 192.168.0.2) | |
Continue with this plan? [Y/n] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pappardelle failover --member [email protected] [--new-master 192.168.0.2] |