Marius van Witzenburg

Life can be so beautiful, if you have a wide vision.

Menu
  • Home
  • FreeBSD
  • How to
  • FAQ
  • Projects
  • Things I like

Tag: Control

How to control HAProxy using Ansible with Unix Socket Commands

By mariusvw
|
November 6, 2016
| No Comments
| How to

When using HAProxy for loadbalancing it might become handy to control your active and inactive servers. In my case I wanted to control the loadbalancers with Ansible. For this example you need HAproxy, Ansible and the Ansible HAProxy module. First you have to enable the socket in HAProxy to be able to control anything. More info […]

Read More »

Posted in How to Tagged Ansible, Control, HAProxy, Loadbalancer, Socket Leave a comment

How to trap or catch Keyboard Interrupt in Bash

By mariusvw
|
May 18, 2010
| No Comments
| How to

Sometimes you want to clean up some things when your script gets stopped for whatever reason. This script captures the SIGINT signal and sends it to the myExit function. The myExit function calls another function (just to show what is possible) which removes a logfile.

Shell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
myCleanup() {
  rm -f /myapp/tmp/mylog
  return $?
}
myExit() {
  echo -en "n*** Exiting ***n"
  myCleanup
  exit $?
}
 
trap myExit SIGINT
# main loop
while true
do
    echo -n "Enter your name: "
    read x
    echo "Hello $x"
done

If you map the SIGINT signal to a function […]

Read More »

Posted in How to Tagged Bash, Control, Interrupt, Keyboard, Trap Leave a comment

Social

Search

Archives

  • December 2017
  • October 2017
  • September 2017
  • March 2017
  • February 2017
  • January 2017
  • November 2016
  • October 2016
  • February 2016
  • December 2015
  • March 2015
  • November 2013
  • July 2013
  • May 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • December 2011
  • November 2011
  • July 2011
  • June 2011
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • January 2010

Categories

  • FAQ
  • FreeBSD
  • FreeBSD world
  • Funny
  • How to
  • Projects

FreeBSD

Proud Donor

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Marius van Witzenburg 2018 | All Rights Reserved. Powered by WordPress