msql: How to Backup and Restore mysql databases

BACKUP specific database „database_name”:
mysqldump -u username -p database_name > backup_name.sql

BACKUP all databases:
# mysqldump -u root -p –all-databases > mysqldump.sql

Without events
# mysqldump -u root -p –all-databases –events > mysqldump.sql

or with compress:
# mysqldump -u root -p –all-databases | gzip > mysqldump.sql.gz

———————————————————————————

Restore specific database „database_name” from file „only_one_database_name.sql”:
# mysql -u username -p database_name < only_one_database_name.sql

RESTORE all databases from file „mysqldump_alldatabases.sql”:
# mysql -u root -p < mysqldump_alldatabases.sql

Linux: How to Install Node.js on Debian 6 (Squeeze)?

robert@localhost~$ sudo apt-get update && sudo apt-get install git-core curl build-essential openssl libssl-dev
robert@localhost~$ git clone https://github.com/joyent/node.git
robert@localhost~$ cd node
robert@localhost~$ git checkout v0.10.28 (check the current version on http://nodejs.org/download/)
robert@localhost~$ ./configure –openssl-libpath=/usr/lib/ssl
robert@localhost~$ make
robert@localhost~$ sudo make install
robert@localhost~$ node -v
robert@localhost~$ npm -v

Linux, APC: How to show status of the APC UPS in Linux?

robert@localhost$ apcaccess status

Show only STATUS: online or battery.
robert@localhost$ apcaccess status | grep STATUS | awk ‚{print $3}’

Ok, write small script to check if UPS is online.
Create apc_status.sh file, put below code inside of the file, write the file, add execute permission to file (chmod +x apc_status.sh).

#!/bin/bash
$status=`apcaccess status | grep STATUS | awk ‚{print $3}’`

if [ $status == „ONLINE” ]; then
echo „ONLINE”
exit 0
else
echo „ON BATTERY” | mailx -s „APC Status” user@domain.com
fi

Information:
„command”, ‚command’ – command is a string and go to variable
`command` – command is executed and output go to variable

Source: http://www.apcupsd.org/manual/manual.html

Linux, OpenSSL: How to install OpenSSL from Sources in Linux

robert@i5:~/Downloads$ mkdir openssl
robert@i5:~/Downloads/openssl$ mkdir openssl

robert@i5:~/Downloads/openssl$ wget https://www.openssl.org/source/openssl-1.0.1g.tar.gz
robert@i5:~/Downloads/openssl$ tar -xvzf openssl-1.0.1g.tar.gz
robert@i5:~/Downloads/openssl$ cd openssl-1.0.1g

robert@i5:~/Downloads/openssl$ ./config
robert@i5:~/Downloads/openssl$ make depend
robert@i5:~/Downloads/openssl$ make
robert@i5:~/Downloads/openssl$ make test
robert@i5:~/Downloads/openssl$ sudo make install

robert@i5:~/Downloads/openssl$ openssl version

Centos 6: NFS mount folder as nobody

The nfs mount map folder as nobody:nobody on CentOS 6.
The issue was idmapd had cached the incorrect ids from the faulty configuration.

To fix it enter command:
root@localhost$ nfsidmap -c (clear cache)