Screen brightness reset in Ubuntu


My Ubuntu laptop’s screen brightness resets everytime after reboot. I have found a way to make the brightness adjustment ‘stay permantly’:

1) Adjust the brightness to the level that I like, then run ‘cat /sys/class/backlight/acpi_video0/brightness ‘. The command will return the brightness level in a integer value. Mine is 12.
2) Add the line ‘echo 12 > /sys/class/backlight/acpi_video0/brightness‘ into the /etc/rc.local file.

Fortinet SSL VPN Client in Ubuntu


It is intereting that the Fortinet SSL VPN client works fine in my Windows machine, but does not work in my Ubuntu laptop. I have found the reason is that a few routes are missed in the routing table. To make it work, I wrote a script to manually add those routes after VPN is connected.

Create an executable file named VPN under /usr/local/bin. Next time just run the command VPN to connect vpn and add routes.

#!/bin/bash

# Start VPN
/home/jchen/Downloads/forticlientsslvpn/forticlientsslvpn&

# Check if ppp0 is ready
while ! ifconfig  | grep ppp0 >/dev/null 2>&1
do
echo VPN is connecting…
sleep 3
done

# Add routes
IP=`ifconfig ppp0 | grep ‘inet addr’ | awk ‘{print $2}’ | cut -d’:’ -f2`
sudo route add -net 1.1.1.0/24 gw $IP dev ppp0
sudo route add -net 2.2.2.0/24 gw $IP dev ppp0

Auto Configure Proxy in Ubuntu


It is painful to turn the proxy on and off in my Ubuntu laptop between office and home.  As a lazy guy, I would like to make it automatic. Easy life now :)
1) Create 3 scripts named proxy_on, proxy_off and check_proxy under /usr/local/bin.
#!/bin/bash
#proxy_on
gsettings set org.gnome.system.proxy.socks host ‘proxy.company.local’
gsettings set org.gnome.system.proxy.socks port 80
gsettings set org.gnome.system.proxy mode ‘manual’
#!/bin/bash
#proxy_off
gsettings set org.gnome.system.proxy mode ‘none’

#!/bin/bash
#check_proxy
ping_test=`ping -c 2 proxy.company.local | grep bytes | wc -l`
if [ "$ping_test" -gt 1 ]; then
proxy_on
else
proxy_off
fi

2) Add check_proxy to the auto startup programes by creating the file ~/.config/autostart/check_proxy.desktop
[Desktop Entry]
Type=Application
Exec=check_proxy
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_AU]=check_proxy
Name=check_proxy
download_icon

Check ESX Plugin for Nagios


Check ESX is a plugin developed by op5 to primarily be used with op5 Monitor, but can also be used in Nagios installations, to monitor VMware ESX and vSphere servers. You can monitor either a single ESX(i)/vSphere server or a VMware VirtualCenter/vCenter Server and individual virtual machines. If you have a VMware cluster you should monitor the data center (VMware VirtualCenter/vCenter Server) and not the ESX/vSphere servers by them self.

References:

Check ESX Plugin
Monitor VMware ESXi with your existing Nagios application

Install WordPress on CentOS 6.3


Steps of installing WordPress on CentOS 6.3 minimal installation.

1) Install prerequisite packages.

[root@CentOS ~]# yum -y install php php-mysql mysql* wget unzip

image

2) Download the latest version of WordPress.

[root@CentOS ~]# wget http://wordpress.org/latest.zip
[root@CentOS ~]# unzip latest.zip
[root@CentOS ~]# mv wordpress/ /var/www/html/

3) Configure mysql database server.

[root@CentOS ~]# service mysqld start
[root@CentOS ~]# mysql -u root –p

mysql>  CREATE DATABASE wordpress;
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO “wordpress”@”localhost” IDENTIFIED BY “wordpress”;
mysql> FLUSH PRIVILEGES;
mysql> exit

Test the newly created wordpress user
[root@CentOS ~]# mysql -u wordpress -p

image

4) Configure the mysql DB connection info in wordpress configuration file.

[root@CentOS html]# cd /var/www/html/wordpress/
[root@CentOS wordpress]# cp wp-config-sample.php wp-config.php

Edit wp-config.php file, the secret key be obtained from https://api.wordpress.org/secret-key/1.1/salt/

image

5) Configure the WordPress virtual directory in Apache.

[root@CentOS html]# vi /etc/httpd/conf/httpd.conf

# WordPress home folder
Alias /wp/ “/var/www/html/wordpress/”
<Directory “/var/www/html/wordpress”>
Order allow,deny
Allow from all
</Directory>

[root@CentOS wordpress]# service httpd restart

6) Go to the WordPress configuration page – http://centos/wp/wp-admin/install.php

image

image