Posts Tagged ‘code’
Wednesday, April 14th, 2021 
Say you have access to a remote Linux / UNIX / BSD server, i.e. a jump host and you have to remotely access via ssh a bunch of other servers
who have existing IP addresses but the DNS resolver recognized hostnames from /etc/resolv.conf are long and hard to remember by the jump host in /etc/resolv.conf and you do not have a way to include a new alias to /etc/hosts because you don't have superuser admin previleges on the hop station.
To make your life easier you would hence want to add a simplistic host alias to be able to easily do telnet, ssh, curl to some aliased name like s1, s2, s3 … etc.
The question comes then, how can you define the IPs to be resolvable by easily rememberable by using a custom User specific /etc/hosts like definition file?
Expanding /etc/hosts predefined host resolvable records is pretty simple as most as most UNIX / Linux has the HOSTALIASES environment variable
Hostaliases uses the common technique for translating host names into IP addresses using either getaddrinfo(3) or the obsolete gethostbyname(3). As mentioned in hostname(7), you can set the HOSTALIASES environment variable to point to an alias file, and you've got per-user aliases
create ~/.hosts file
linux:~# vim ~/.hosts
with some content like:
g google.com
localhostg 127.0.0.1
s1 server-with-long-host1.fqdn-whatever.com
s2 server5-with-long-host1.fqdn-whatever.com
s3 server18-with-long-host5.fqdn-whatever.com
…
linux:~# export HOSTALIASES=$PWD/.hosts
The caveat of hostaliases you should know is this will only works for resolvable IP hostnames.
So if you want to be able to access unresolvable hostnames.
You can use a normal alias for the hostname you want in ~/.bashrc with records like:
alias server-hostname="ssh username@10.10.10.18 -v -o stricthostkeychecking=no -o passwordauthentication=yes -o UserKnownHostsFile=/dev/null"
alias server-hostname1="ssh username@10.10.10.19 -v -o stricthostkeychecking=no -o passwordauthentication=yes -o UserKnownHostsFile=/dev/null"
alias server-hostname2="ssh username@10.10.10.20 -v -o stricthostkeychecking=no -o passwordauthentication=yes -o UserKnownHostsFile=/dev/null"
…
then to access server-hostname1 simply type it in terminal.
The more elegant solution is to use a bash script like below:
# include below code to your ~/.bashrc
function resolve {
hostfile=~/.hosts
if [[ -f “$hostfile” ]]; then
for arg in $(seq 1 $#); do
if [[ “${!arg:0:1}” != “-” ]]; then
ip=$(sed -n -e "/^\s*\(\#.*\|\)$/d" -e "/\<${!arg}\>/{s;^\s*\(\S*\)\s*.*$;\1;p;q}" "$hostfile")
if [[ -n “$ip” ]]; then
command "${FUNCNAME[1]}" "${@:1:$(($arg-1))}" "$ip" "${@:$(($arg+1)):$#}"
return
fi
fi
done
fi
command "${FUNCNAME[1]}" "$@"
}
function ping {
resolve "$@"
}
function traceroute {
resolve "$@"
}
function ssh {
resolve "$@"
}
function telnet {
resolve "$@"
}
function curl {
resolve "$@"
}
function wget {
resolve "$@"
}
Now after reloading bash login session $HOME/.bashrc with:
linux:~# source ~/.bashrc
ssh / curl / wget / telnet / traceroute and ping will be possible to the defined ~/.hosts IP addresses just like if it have been defined global wide on System in /etc/hosts.
Enjoy
Tags:
access,
adding,
addresses,
admin,
after,
alias,
ALLOW,
and,
are,
Arg,
based,
bash script,
bashrc,
Below,
BSD,
bunch,
code,
com,
command,
common Tags: access, adding, addresses, admin, after, alias, ALLOW, and, are, Arg, based, bash script, bashrc, Below, BSD, bunch, code, com, command, common
Posted in Educational, Hacks, System Administration, Various | No Comments »
Wednesday, January 15th, 2020 
If you get some error with some service that is start / stopped via systemctl you might be pondering how to debug further why the service is not up then then you'll be in the situation I was today.
While on one configured server with 8 eth0 configured ethernet network interfaces the network service was reporting errors, when atempted to restart the RedHat way via:
service network restart
to further debug what the issue was as it was necessery I had to find a way how to debug systemctl so here is how:
How to do a verbose messages status for sysctlct?
linux:~# systemctl status network
linux:~# systemctl status network
Another useful hint is to print out only log messages for the current boot, you can that with:
# journalctl -u service-name.service -b
if you don't want to have the less command like page separation ( paging ) use the –no-pager argument.
# journalctl -u network –no-pager
Jan 08 17:09:14 lppsq002a network[8515]: Bringing up interface eth5: [ OK ]
Jan 08 17:09:15 lppsq002a network[8515]: Bringing up interface eth6: [ OK ]
Jan 08 17:09:15 lppsq002a network[8515]: Bringing up interface eth7: [ OK ]
Jan 08 17:09:15 lppsq002a systemd[1]: network.service: control process exited, code=exited status=1
Jan 08 17:09:15 lppsq002a systemd[1]: Failed to start LSB: Bring up/down networking.
Jan 08 17:09:15 lppsq002a systemd[1]: Unit network.service entered failed state.
Jan 08 17:09:15 lppsq002a systemd[1]: network.service failed.
Jan 15 11:04:45 lppsq002a systemd[1]: Starting LSB: Bring up/down networking…
Jan 15 11:04:45 lppsq002a network[55905]: Bringing up loopback interface: [ OK ]
Jan 15 11:04:45 lppsq002a network[55905]: Bringing up interface eth0: RTNETLINK answers: File exists
Jan 15 11:04:45 lppsq002a network[55905]: [ OK ]
Jan 15 11:04:45 lppsq002a network[55905]: Bringing up interface eth1: RTNETLINK answers: File exists
Jan 15 11:04:45 lppsq002a network[55905]: [ OK ]
Jan 15 11:04:46 lppsq002a network[55905]: Bringing up interface eth2: ERROR : [/etc/sysconfig/network-scripts/ifup-eth] Device eth2 has different MAC address than expected, ignoring.
Jan 15 11:04:46 lppsq002a network[55905]: [FAILED]
Jan 15 11:04:46 lppsq002a network[55905]: Bringing up interface eth3: RTNETLINK answers: File exists
Jan 15 11:04:46 lppsq002a network[55905]: [ OK ]
Jan 15 11:04:46 lppsq002a network[55905]: Bringing up interface eth4: ERROR : [/etc/sysconfig/network-scripts/ifup-eth] Device eth4 does not seem to be present, delaying initialization.
Jan 15 11:04:46 lppsq002a network[55905]: [FAILED]
Jan 15 11:04:46 lppsq002a network[55905]: Bringing up interface eth5: RTNETLINK answers: File exists
Jan 15 11:04:46 lppsq002a network[55905]: [ OK ]
Jan 15 11:04:46 lppsq002a network[55905]: Bringing up interface eth6: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: [ OK ]
Jan 15 11:04:47 lppsq002a network[55905]: Bringing up interface eth7: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: [ OK ]
Jan 15 11:04:47 lppsq002a network[55905]: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a network[55905]: RTNETLINK answers: File exists
Jan 15 11:04:47 lppsq002a systemd[1]: network.service: control process exited, code=exited status=1
Jan 15 11:04:47 lppsq002a systemd[1]: Failed to start LSB: Bring up/down networking.
Jan 15 11:04:47 lppsq002a systemd[1]: Unit network.service entered failed state.
Jan 15 11:04:47 lppsq002a systemd[1]: network.service failed.
Jan 15 11:08:22 lppsq002a systemd[1]: Starting LSB: Bring up/down networking…
Jan 15 11:08:22 lppsq002a network[56841]: Bringing up loopback interface: [ OK ]
Jan 15 11:08:22 lppsq002a network[56841]: Bringing up interface eth0: RTNETLINK answers: File exists
Jan 15 11:08:22 lppsq002a network[56841]: [ OK ]
Jan 15 11:08:26 lppsq002a network[56841]: Bringing up interface eth1: RTNETLINK answers: File exists
Jan 15 11:08:26 lppsq002a network[56841]: [ OK ]
Jan 15 11:08:26 lppsq002a network[56841]: Bringing up interface eth2: ERROR : [/etc/sysconfig/network-scripts/ifup-eth] Device eth2 has different MAC address than expected, ignoring.
Jan 15 11:08:26 lppsq002a network[56841]: [FAILED]
Jan 15 11:08:26 lppsq002a network[56841]: Bringing up interface eth3: RTNETLINK answers: File exists
Jan 15 11:08:27 lppsq002a network[56841]: [ OK ]
Another useful thing debug arguments is the -xe to do:
# journalctl -xe –no-pager
- -x (– catalog)
Augment log lines with explanation texts from the message catalog.
This will add explanatory help texts to log messages in the output
where this is available. - -e ( –pager-end ) Immediately jump to the end of the journal inside the implied pager
tool.

Finally after fixing the /etc/sysconfig/networking-scripts/* IP configuration issues I had all the 8 Ethernet interfaces to work as expected
# systemctl status network
2. Adding a new IP alias to eth0 interface
Further on I had to add an IP Alias on the CenOS via its networking configuration, this is done by editing /etc/sysconfig/network-scripts/ifcfg* files.
To create an IP alias for first lan interface eth0, I've had to created a new file named ifcfg-eth0:0
linux:~# cd /etc/sysconfig/network-scripts/
linux:~# vim ifcfg-eth0:0
with below content
NAME="eth0:0"
ONBOOT="yes"
BOOTPROTO="none"
IPADDR="10.50.10.5"
NETMASK="255.255.255.0"
Adding this IP address network alias works across all RPM based distributions and should work also on Fedora and Open SuSE as well as Suse Enterprise Linux.
If you however prefer to use a text GUI and do it the CentOS server administration way you can use nmtui (Text User Interface for controlling NetworkManager). tool.
linux:~# nmtui


Tags:
code,
command,
configured,
control,
down,
How to,
interface,
IPADDR,
linux?,
loopback,
lsb,
MAC,
network,
network interfaces,
ONBOOT,
RTNETLINK,
state,
status,
sysconfig Tags: code, command, configured, control, down, How to, interface, IPADDR, linux?, loopback, lsb, MAC, network, network interfaces, ONBOOT, RTNETLINK, state, status, sysconfig
Posted in Everyday Life, Linux, Networking, System Administration | 2 Comments »
Thursday, November 29th, 2018
Recently I had to use PuTTY which I haven't used for years to open a number of SSH Pernanent Tunnels necessery for my daily work as a SAP Consultant.
I've saved them under a certain new profile and saved the set SSH Tunnel configuration not in the default Session but in separate named one, therefore had to press Load button every time after clicking over my Putty shortcut icon.
That was annoying and took few seconds out of my life every next morning for about a week, so finally I found osme time to google it and it seemed it is pretty easy to have any Putty sessoin loaded you like.
Here is how:
1. Create a new Putty Shortcut
Click over Putty icon while holding CTRL + SHIFT (Control SHIFT keys simultaneously ) and move the mouse somewhere on the desktop to create the shortcut.
2. Right click on Putty Shortcut
"C:\Program Files\PuTTY\putty.exe" -load "your_saved_session" "username@your_server_address" -pw "your_password"
fill out "target" field of shortcut using above code (alter to your own properties).
click Apply button.
If you need to pass a user and password from Shortcut itself (which is a bad practice for security but sometimes useful, for not so important Tunnels – for example a tunnel to an Open Proxy), do it by typing in the target field like so:
"C:\Program Files\PuTTY\putty.exe" -load "your_saved_session" "username@your_server_address" -pw "your_password"
And Hooray !!! After that when you click on PuTTy shortcut it loads your session automatically using given username and password.
Tags:
about,
after,
and,
annoying,
another,
ANY,
Button,
Click,
code,
Configuration,
control,
create,
Ctrl,
daily,
default,
Desktop,
Easy,
example,
Putty,
session Tags: about, after, and, annoying, another, ANY, Button, Click, code, Configuration, control, create, Ctrl, daily, default, Desktop, Easy, example, Putty, session
Posted in Everyday Life, Windows | No Comments »
Saturday, June 21st, 2014 
For people running Mac OS X, the question of how is it possible to use 2 skype accounts in parallel on Mac probably makes good sense?
I don't own a Mac notebook and thefore I'm a Mac newbie, however, I'm into situation where I and my wife Svetlana went (for 3 days) to my hometown Dobrich and we have with us only her Mac OS X powered Mac Book air.
One user is already logged in Skype, (my wife) is expecting some relatives and friends to contact us and same time I had to login to check few servers via ssh and discuss some server downtime issues from yesterday in Skype .
Thus we need 2 skype instances to run separately on her Macbook air powered PC with Mac OS X Leopard
Earlier I've blogged how to make 2 and more Skype accounts work simultaneously on one Windows PC because I had to set it up for a company, in this short article I will explain how is possible to run many skype clients on Mac OS X.
1. Open Mac Terminal from Finder
2. In Terminal run the first Skype Instance
Type in Terminal:
open /Applications/Skype.app/Contents/MacOS/Skype
3. Run Second Skype instance
In older Skype Mac OS versions, I read the
/secondary
Skype command option was there and could be used to run a second parallel skype instance on Mac, however in newer releases this option was removed and if you try to invoke it warning window pops up saying an instance is already running.
To get around the issue and run the second Skype, quickest way is to run another Skype client under privileged user through sudo command (this is unsecure – but anyways as Mac OS is proprietary and we don't have access to code and probably there are tons of spy and report software integrated into the OS, it doesn't really matter.)
To get around the issue and run the second Skype, quickest way is to run another Skype client under privileged user through sudo command (this is unsecure – but anyways as Mac OS is proprietary and we don't have access to code and probably there are tons of spy and report software integrated into the OS, it doesn't really matter.)
4. Script it into 2nd_skype.sh for later use
To run and use two parallel skypes regularly it might be useful to make shell script out of it and place it somewhere, 2nd_skype.sh script should be something like:
#!/bin/bash
open /Applications/Skype.app/Contents/MacOS/Skype
sudo /Applications/Skype.app/Contents/MacOS/Skype
Then make the script executable with:
chmod a+x 2nd_skype.sh
5. Run more than 2 Skypes (Run multiple Skypes on same Mac PC hack)
There is another "hack" method with deleting the Skype.pid (Process ID). Skype recognize where it is running by checking its Skype.pid on start up.
Deleting the pid after each next Skype client launch, allow the user to run as many Skypes as you want on Mac OS X but it is not clear for how long it time it will work.
rm -f ~/Library/Application Support/Skype/Skype.pid
Then launch again Skype in background from Mac Terminal
open -nW '/Application/Skype.app' &
In case if you wonder why the open command is used, since above line could be run also directly and Skype will pop-up, by using open command you instruct the program to detach itself from Terminal from which it run, so later if Terminal is closed Skype app. will not terminate.
Another approach is to create, a many users lets say 5 users and use the Skype sudo run method each client with a separate user.
sudo user1 /Applications/Skype.app/Contents/MacOS/Skype
sudo user2 /Applications/Skype.app/Contents/MacOS/Skype
sudo user3 /Applications/Skype.app/Contents/MacOS/Skype
sudo user4 /Applications/Skype.app/Contents/MacOS/Skype
sudo user5 /Applications/Skype.app/Contents/MacOS/Skype
I enclose the script with the custom icon (Skype) ready to be launched and Voila, on script launch Skype multiple login prompts pops up.
For the lazy ones who don't want to tamper with writting scripts or doing hacks to run Skype multiple times on Mac there is even a Multi Skype Launcher app for Mac.
Tags:
Applications Skype,
check,
code,
command,
contact,
Deleting,
good,
Mac Book,
make,
OS,
pops,
question,
run,
sense,
shell script,
software,
sudo,
yesterday Tags: Applications Skype, check, code, command, contact, Deleting, good, Mac Book, make, OS, pops, question, run, sense, shell script, software, sudo, yesterday
Posted in Curious Facts, Everyday Life, Mac OS X, Various | 3 Comments »
Friday, June 6th, 2014
Out Of Memory Errors, or OOMEs, are one of the most common problems faced by Apache Tomcat users. Tomcat cluster behind Apache unreachable (causing customer downtimes). OOME errors occur on production servers that are experiencing an unusually high spike of traffic.
Out of memory errors are usually a problem of application and not of Tomcat server. OMEs have become such a persistent topic of discussion in the Apache Tomcat community cause its so difficult to trace to their root cause. Usually 'incorrect' web app code causing Tomcat to run out of memory is usually technically correct.
Most common reasons for Out of Memory errors in application code are:
- the heap size being too small
- running out of file descriptors
- more open threads than the host OS allows
- code with high amounts of recursion
- code that loads a very large file into memory
- code that retaining references to objects or classloaders
- a large number of web apps and a small PermGen
The following java option -XX:OnOutOfMemoryError= could be added to any of tomcat java application servers in setenv.sh in JAVA_OPTS= variable in case of regular Out of Memory errors occur making an application unstable.
-XX:OnOutOfMemoryError=<path_to_tomcat_shutdown_script.sh>
Where < path_to tomcat_shutdown_script.sh > is shutdown script(which performs kill <tomcat_pid> if normal shutdown fails) for the tomcat instance.
With this setup if any tomcat instance run out of memory it will be shutdown (shutdown script invoked) – as result the Apache proxy infront of Tomcats should not pass any further requests to this instance and application will visualize / work properly for end customers.
Usually a tomcat_shutdown_script.sh to invoke in case of OOM would initiate a Tomcat server restart something like:
for i in `ps -ef |grep tomcat |grep /my_path_to_my_instance | awk '{print $2}'`
do
kill -9 "$i"
#path and script to start tomcat
done
To prevent blank pages returned to customer because of shutdown_script.sh starting stopping Tomcat you can set in Reverse Apache Proxy something like:
<Proxy balancer://mycluster>
BalancerMember ajp://10.16.166.48:11010/ route=delivery1 timeout=30 retry=1
BalancerMember ajp://10.16.166.70:11010/ route=delivery2 timeout=30 retry=1
</Proxy>
Where in above example I assume, there are only two tomcat nodes, for more just add respective ones.
Note that if the deployed application along all servers is having some code making it crash all tomcat nodes can get shutdown all time and you can get in a client havoc 🙂
Tags:
application,
cause,
code,
common,
instance,
memory,
running,
script,
server node,
servers,
shutdown,
web Tags: application, cause, code, common, instance, memory, running, script, server node, servers, shutdown, web
Posted in Everyday Life, System Administration, Various, Web and CMS | 2 Comments »
Tuesday, May 13th, 2014 
GNU Grep is equipped with a special option "-r" to grep recursively. Looking for string in a file in a sub-directories tree with the -r option is a piece of cake. You just do:
grep -r 'string' /directory/
or if you want to search recursively non-case sensitive for text
grep -ri 'string' .
Another classic GNU grep use (I use almost daily) is whether you want to match all files containing (case insensitive) string among all files:
grep -rli 'string' directory-name
Now if you want to grep whether a string is contained in a file or group of files in directory recursively on some other UNIX like HP-UX or Sun OS / Solaris where there is no GNU grep installed by default here is how to it:
find /directory -exec grep 'searched string' {} dev/null ;
Note that this approach to look for files containing string on UNIX is very slowThus on not too archaic UNIX systems for some better search performance it is better to use xargs;
find . | xargs grep searched-string
A small note to open here is by using xargs there might be weird results when run on filesystems with filenames starting with "-".
Thus comes the classical (ultimate) way to grep for files containing string with find + grep, e.g.
find / -exec grep grepped-string {} dev/null ;
Another way to search a string recursively in files is by using UNIX OS '*' (star) expression:
grep pattern * */* */*/* 2>/dev/null
Talking about recursive directory text search in UNIX, should mention another good GNU GREP alternative ACK – check it on betterthangrep.com 🙂 . Ack is perfect for programmers who have to dig through large directory trees of code for certain variables, functions, objects etc.
Tags:
cake,
code,
directory,
file,
filesystems,
GNU,
grep,
How to,
Linux,
look,
match,
note,
piece,
piece of cake,
recursively,
string,
text,
unix,
variables,
xargs Tags: cake, code, directory, file, filesystems, GNU, grep, How to, Linux, look, match, note, piece, piece of cake, recursively, string, text, unix, variables, xargs
Posted in Programming, System Administration, Various | 1 Comment »
Friday, April 25th, 2014 
PHP Notices are common to occur after PHP version upgrades or where an obsolete PHP code is moved from Old version PHP to new version. This is common error in web software using Frameworks which have been abandoned by developers.
Having PHP Notices to appear on a webpage is pretty ugly and give a lot of information which might be used by malicious crackers to try to break your site thus it is always a good idea to disable PHP Notices. There are plenty of ways to disable PHP Notices
The easiest way to disable it is globally in all Webserver PHP library via php.ini (/etc/php.ini) open it and make sure display_errors is disabled:
display_errors = 0
or
Note that that some claim in PHP 5.3 setting display_errors to Off will not work as expected. Anyways to make sure where your loaded PHP Version display_errors is ON or OFF use phpinfo();
It is also possible to disable PHP Notices and error reporting straight from PHP code you need code like:
<?php
// Turn off all error reporting
error_reporting(0);
?>
or through code:
ini_set('display_errors',0);
PHP has different levels of error reporting, here is complete list of possible error handling variables:
<?php
// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings …)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
// Report all PHP errors error_reporting(-1);
// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL); ?>
The level of logging could be tuned on Debian Linux via /etc/php5/apache2/php.ini or if necessary to set PHP log level in PHP CLI through /etc/php5/cli/php.ini with:
error_reporting = E_ALL & ~E_NOTICE
If you need to remove to remove exact warning or notices from PHP without changing the way PHPLib behaves is to set @ infront of variable or function that is causing NOTICES or WARNING:
For example:
@yourFunctionHere();
@var = …;
Its also possible to Disable PHP Notices and Warnings using .htaccess file (useful in shared hosting where you don't have access to global php.ini), here is how:
# PHP error handling for development servers
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
php_flag report_memleaks on
php_flag track_errors on
php_value docref_root 0
php_value docref_ext 0
php_value error_log /home/path/public_html/domain/php_errors.log
php_value error_reporting -1
php_value log_errors_max_len 0
This way though PHP Notices and Warnings will be suppressed errors will get logged into php_error.log
Tags:
code,
com,
common,
default,
developers,
good,
ini,
level,
log,
make,
OFF,
Old,
php,
php5,
setting,
software,
stackoverflow,
turn,
Turn Off,
value,
version,
Warnings,
web,
webpage,
work Tags: code, com, common, default, developers, good, ini, level, log, make, OFF, Old, php, php5, setting, software, stackoverflow, turn, Turn Off, value, version, Warnings, web, webpage, work
Posted in PHP, Programming, System Administration, Web and CMS | 4 Comments »
Thursday, April 24th, 2014
Since I've bought ZTE smat phone and I have Android on it, decided to install Viber – iOS, Android and Desktop PC – Free Calls, Text and Picture sharing through the internet app. Viber is used by a lot of my people including many friends already so I installed it as well to be possible to speak for free with close friends …
Why Viber?
What makes this nifty app so great is its capability to make free calls over mobile phones through the Internet Viber.
Viber saves you a lot of money as calls are handled only through the Internet (you need Wifi on your mobile or Mobile 3G Internet access on phone) and you don't need to pay to your mobile operator 0.10 – 0.15 euro / cents per minute. Besides being Free another advantage of Viber is conversations sound quality which is much better than a regular phone call
Viber doesn't need a special registration, but as (login) identificator uses your mobile phone number – you just need to have a working Mobile operator phone num. Once registered under a number even if you change your mobile sim card to other operator (for example moving from country to country) still the Viber account will continue work. Another good reason to use Viber is it makes possible price free calls between different countries (for example if you travel a lot and you want to regularly speak with your wife) – in my case right now I'm in Bulgaria and my wife is in Belarus, so to save money and keep talking daily we use Viber daily.
What Devices and Operating System Viber Supports and what is Viber advantages / disadvantages ?
Another reason why Viber is so great is its multi-platform support it works on iPhone, Blackberry, Windows Phone, Nokia (Symbian), Windows, Mac OS and even (Korean own OS-ed) Bada devices. Some might argue that Viber is inferior to Skype and interms of Voice and Video quality its better because of its enhanced HD voice enhanced codecs, besides that Viber's video is still in Beta. However Viber has one big advantage it makes easy possible to reach people using just their Mobile Phone numbers where in Skype it takes time and effort to register in Skype install application on your Mobile keep yourself logged in in Skype and have all contacts previously added, all this happens automatically in Viber in time of installation of Viber App on your mobile.
Which Is Cheaper Viber or Skype?
Once installed Viber could integrate itself with rest of your Mobile OS Call Manager and in time of call a friend number you have the opportunity to make it free Viber call. Viber are also selling Viber Credits so if you want to use your Viber Voice Over IP you can call external mobile operator numbers on a very very cheap price. Viber Calls to landline or mobile phones could be up to 400% cheaper than Skype! Whether you own a Smartphone it will be nice to give Viber a try.
Viber – How to make Phone calls between Desktop PC and Smarphone Mobile
One not so standard Viber use is to make Viber calls with no smartphone (at hand) from PC to another Viber equipped Mobile and vice versa.
I needed to make Viber calls from my ZTE Android running mobile to my wife's MacBook Air PC because her mobile is an old Nokia running obscure Symbian version which is not supporting Viber + she doesn't have an Internet access tariff switched on her mobile.
Here is what I had to do to make Phone calls between my Mobile Viber App and my wife's MacbookAir Notebook PC:
- Install BlueStacks Web App Player

BlueStacks App Player is a software designed to enable Android applications to run on Windows PC, Apple Macintosh Computers and Windows tablets. BlueStacks is something like (VMware, Qemu) Virtual Machine which allows you to install and run any Android App on your Desktop PC.
Its curious that app was created by Rosen Sharma in 2008 an ex CTO (Chief Technology Officer) of McAfee
- A mobile phone with a working SIM card (Nokia 6310 or any old mobile no need to be a smartphone
- Desktop PC with Windows 7, 8 or PC with Mac OS
Install Bluestacks
BlueStacks is needed in order to emulate a smartphone on your PC, therefore once setupped Bluestacks. Launch it and inside its necessary to login with your Gmail (Google Account) in order to allow access to Google Play Appstore on your PC.
viber with no mobile phone bluestacks
Installing and Verifying Viber
This is the most crucial and tricky part in order to make Viber working on any device you need to receive a special Viber verification code, you need to fill in this code to confirm Viber installation on PC. Here I assume you have BlueStacks running with Viber Application installed.
First will be prompted to Agree with Terms and Conditions and provide Mobile Phone number for verification. Tell the Viber app that you have a smartphone with Viber already when prompted. After receving Viber Verification Code you need to fill in this code into BlueStacks Window (inside Viber should be running), go further to next step and you should be done with Desktop PC Viber number registration.
N.B. ! One brackets to open here is you need to have a working Mobile Phone number where you will receive the verification code as SMS, otherwise you cannot get the verification. On your filled in mobile phone number you will get the verification code as SMS.
Making Viber Calls to (Windows Mac) PC without Smartphone
There is no more further need for BlueStacks so you can uninstall it, however I preferred to keep it as its useful to be able to install Android Applications straight on your Desktop PC. To start using Viber on Desktop, just launch Viber application (not through BlueStacks) but the direct install.
Use Viber dial pad to dial your desired remote Smartphone number with Viber equipped.
Enjoy the free Internet calls ! 🙂
Tags:
apps,
code,
com,
conversations,
Enjoy,
good reason,
Installing,
Internet,
make,
Make Viber,
minute,
Mobile,
mobile phone,
money,
need,
number,
Pc,
phone,
phone call,
phone number,
run,
Skype,
Skype Whether,
time,
Viber App,
Viber Verification Code,
Windows,
www Tags: apps, code, com, conversations, Enjoy, good reason, Installing, Internet, make, Make Viber, minute, Mobile, mobile phone, money, need, number, Pc, phone, phone call, phone number, run, Skype, Skype Whether, time, Viber App, Viber Verification Code, Windows, www
Posted in Everyday Life, Mobile Phone Apps & Games, Various, Windows | 6 Comments »
Wednesday, April 16th, 2014 
If you login to server and after running dmesg – show kernel log command you get tons of messages like:
# dmesg
end_request: I/O error, dev sdc, sector 0
sd 0:0:0:1: SCSI error: return code = 0x00010000
end_request: I/O error, dev sdb, sector 0
sd 0:0:0:0: SCSI error: return code = 0x00010000
end_request: I/O error, dev sda, sector 0
sd 0:0:0:2: SCSI error: return code = 0x00010000
end_request: I/O error, dev sdc, sector 0
sd 0:0:0:1: SCSI error: return code = 0x00010000
end_request: I/O error, dev sdb, sector 0
sd 0:0:0:0: SCSI error: return code = 0x00010000
end_request: I/O error, dev sda, sector 0
sd 0:0:0:2: SCSI error: return code = 0x00010000
end_request: I/O error, dev sdc, sector 0
sd 0:0:0:1: SCSI error: return code = 0x00010000
end_request: I/O error, dev sdb, sector 0
sd 0:0:0:0: SCSI error: return code = 0x00010000
end_request: I/O error, dev sda, sector 0
In /var/log/messages there are also log messages present like:
# cat /var/log/messages
...
Apr 13 09:45:49 sl02785 kernel: end_request: I/O error, dev sda, sector 0
Apr 13 09:45:49 sl02785 kernel: klogd 1.4.1, ———- state change ———-
Apr 13 09:45:50 sl02785 kernel: sd 0:0:0:1: SCSI error: return code = 0x00010000
Apr 13 09:45:50 sl02785 kernel: end_request: I/O error, dev sdb, sector 0
Apr 13 09:45:55 sl02785 kernel: sd 0:0:0:2: SCSI error: return code = 0x00010000
Apr 13 09:45:55 sl02785 kernel: end_request: I/O error, dev sdc, sector 0
This is a sure sign something is wrong with SCSI hard drives or SCSI controller, to further debug the situation you can use the multipath command, i.e.:
multipath -ll | grep -i failed
_ 0:0:0:2 sdc 8:32 [failed][faulty]
_ 0:0:0:1 sdb 8:16 [failed][faulty]
_ 0:0:0:0 sda 8:0 [failed][faulty]
As you can see all 3 drives merged (sdc, sdb and sda) to show up on 1 physical drive via the remote network connected – LUN to the server is showing as faulty. This is a clear sign something is either wrong with 3 hard drive members of LUN – (Logical Unit Number) (which is less probable) or most likely there is problem with the LUN network SCSI controller. It is common error that LUN SCSI controller optics cable gets dirty and needs a physical clean up to solve it.
In case you don't know what is storage LUN? – In computer storage, a logical unit number, or LUN, is a number used to identify a logical unit, which is a device addressed by the SCSI protocol or protocols which encapsulate SCSI, such as Fibre Channel or iSCSI. A LUN may be used with any device which supports read/write operations, such as a tape drive, but is most often used to refer to a logical disk as created on a SAN. Though not technically correct, the term "LUN" is often also used to refer to the logical disk itself.
What LUN's does is very similar to Linux's Software LVM (Logical Volume Manager).
Tags:
code,
dev,
dmesg,
How to,
kernel,
Linux,
log,
Logical Unit Number,
LUN,
SCSI,
sda,
sdb,
sdc,
sector,
sign Tags: code, dev, dmesg, How to, kernel, Linux, log, Logical Unit Number, LUN, SCSI, sda, sdb, sdc, sector, sign
Posted in System Administration | No Comments »
Tuesday, February 4th, 2014 
For my daily system administration job I have to login to many SuSE Linux servers and do various configugration edits.
The systems are configured in different ways and the only text editors available across all servers I can use are VI and VIM (VI Improved).
As I usually had to edit configuration files and scripts and I'm on SSH color terminal its rather annoying that on some of the servers opening a file with VIM is not displayed with SYNTAX HIGHLIGHTING. Not having syntax highlighting is ugly and makes editting ugly and unreadable.
Thus it is useful to enable VI syntax highlighting straight into the file being editted. I suspect many novice sysadmins might not know how to turn syntax highlighting in vi so here is how.
Turn Syntax Highlighting in VIM
1. Open file with vim lets say Apache configuration
# vim /etc/apache2/apache2.conf
2. Press (Esc) Escape and ":" from kbd and then type in syntax on
:syntax on

To Turn On / Off VI Syntax Highlighting permanent add ":syntax on"
into ~/.vimrc
~/.vimrc file is red automatically on VIM start, so right after :syntax on is appended in it on relaunch vim will start showing colorfully.
Enjoy ! 🙂
Tags:
code,
conf,
configuration files,
configured,
editor,
editting,
file,
howto,
indent,
Press Esc Escape,
servers,
syntax,
sysadmins,
system administration,
text editors,
turn,
Turn Syntax Highlighting,
vim,
www Tags: code, conf, configuration files, configured, editor, editting, file, howto, indent, Press Esc Escape, servers, syntax, sysadmins, system administration, text editors, turn, Turn Syntax Highlighting, vim, www
Posted in Everyday Life, System Administration, Various | 1 Comment »