Attach or create new Tmux session

I’ve been in a fight with tmux on how to create new session under certain name, but if it already exists to attach to that current one for a very long time. Reason for that was that when I’m connecting to the remote servers I usually have my own session under certain name there and I’d like to attach to that existing one if it already exists. Connecting to the server then issuing:...

April 4, 2017 · 1 min · Ivan Tomica

Nested Tmux

Ever wanted to have tmux session inside of tmux session? Don’t know how to control the one inside of current tmux session? Easily: Ctrl+b Ctrl+b COMMAND So basically, you need to send your prefix twice. You can also use: Ctrl+b+b COMMAND

March 28, 2017 · 1 min · Ivan Tomica

Checking disk activity with ZFS – iostat

Pretty neat little command that I wasn’t aware before, but quick check of the manpage would bring it to my attention. :-) To check current disk activity stats on your zpool you can use: zpool iostat -v POOLNAME You can of course omit pool name, without it it’ll show statistics for all pools. Command output example: $ zpool iostat -v capacity operations bandwidth pool alloc free read write read write ---------- ----- ----- ----- ----- ----- ----- storage 838G 554G 1 40 54....

March 28, 2017 · 1 min · Ivan Tomica

My Tmux configuration

I’ve spent some time tweaking and playing around with my .tmux.conf. If you’re interested in how I did it or search for some inspiration you can find my configuration at the bottom of this post. I’ll briefly explain and showcase some of the options throughout the article. To reload config without closing and re-opening Tmux again I’ve mapped Prefix + r as key combination to source ~/.tmux.conf: # Reload config bind r source-file ~/....

March 4, 2017 · 3 min · Ivan Tomica

Installing PostgreSQL in FreeBSD jail

To install and run PostgreSQL in FreeBSD jail you’ll need to enable allow.sysvipc system tuneable on that specific jail: List jails: jls Note jail ID and use following command to enable it for that running jail: jail -m jid=JAILID allow.sysvipc=1 This can also be accomplished by changing ezjail jail configuration file /usr/local/etc/ezjail/JAILNAME, ensure it contains: export jail_JAILNAME_parameters="allow.sysvipc=1" Install appropriate version of PostgreSQL. There are many different versions but I’ll use 9....

February 19, 2017 · 1 min · Ivan Tomica

Redis as PHP session handler on FreeBSD

This one is quite simple to be honest. Assuming you have Redis already installed and set up correctly you can just change your php-fpm pool definition to include: php_value[session.save_handler] = redis php_value[session.save_path] = "tcp://127.0.0.1:6379" If you’re using password for logging into redis you would specify it like: php_value[session.save_path] = "tcp://127.0.0.1:6379?auth=PASSWORD" Restart php-fpm after that: service php-fpm restart and you should now see PHP saving sessions within Redis service: 127.0.0.1:6379> keys PHPREDIS_SESSION* 1) "PHPREDIS_SESSION:GFtHQ69XH6C7xe5LLYzhJ35zUQACJw" ....

February 14, 2017 · 1 min · Ivan Tomica

FreeBSD Jails – dynamically assign IP address using ezjail

Instead of adding all IP addresses statically to your server via host’s /etc/rc.conf file you may instead leave them out and specify them on per-jail basis. That way when Jail is started IP address gets assigned to specific network interface, and when it is shut down it disappears from that interface. This comes in really handy especially when you’re managing lots of IPv6 only jails, adding all IP addresses to the interface could be tedious and your rc....

February 12, 2017 · 1 min · Ivan Tomica

FreeBSD top(1) – processes within specific jail

On FreeBSD top(1) utility, although having much less command line switches and options is in fact much more powerful than one that comes with your favorite Linux distribution. Maybe one day I decide to publish an in depth write up about it but until that day comes here’s one hint. To show only processes that are running within specific jail launch top: top press: J enter your jail name: examlejail Voila, you have only processes within that specific jail listed....

February 10, 2017 · 1 min · Ivan Tomica

Enable PHP mail() in FreeBSD

On FreeBSD 11 sendmail is not enabled by default. Also by default, php configuration (php.ini) has sendmail binary configured for sending email so using mail() within your PHP application may not work. To resolve that you need to enable sendmail which you can do with: # sysrc sendmail_enable="YES" sendmail_enable: NO -> YES # sysrc sendmail_msp_queue_enable="YES" sendmail_msp_queue_enable: NO -> YES After that just start sendmail with: service sendmail start

February 8, 2017 · 1 min · Ivan Tomica

FreeBSD jails – localhost IP

So, app was connecting from jail’s public IP to the MySQL and that didn’t worked since I had user created like: USER@localhost Instead of: USER@% or USER@JAILIP And that got me confused badly. I would like to thank Mark for clarification.

February 7, 2017 · 1 min · Ivan Tomica