Posts Tagged ‘nomatter’

Start Stop Restart Microsoft IIS Webserver from command line and GUI

Thursday, April 17th, 2014

start-stop-restart-microsoft-iis-howto-iis-server-logo
For a decomissioning project just recently I had the task to stop Microsoft IIS  on Windows Server system.
If you have been into security for a while you know well how many vulnerabilities Microsoft (Internet Information Server) Webserver used to be. Nowadays things with IIS are better but anyways it is better not to use it if possible …

Nomatter what the rason if you need to make IIS stop serving web pages here is how to do it via command line:

At Windows Command Prompt, type:

net stop WAS

If the command returns error message to stop it type:

net stop W3SVC

stop-microsoft-IIS-webservice
Just in case you have to start it again run:

net start W3SVC

start-restart-IIS-webserver-screenshot

For those who prefer to do it from GUI interface, launch services.msc command from Windows Run:

> services.msc

services-msc-stop-microsoft-iis-webserver

In list of services lookup for
IIS Admin Service and HTTP SSL
a) (Click over it with right mouse button -> Properties)
b) Set Startup type to Manual
c) Click Stop Button

You're done now IIS is stopped to make sure it is stopped you can run from cmd.exe:

telnet localhost 80

when not working you should get 'Could not open connection to the host. on port 80: Connection failed' like shown up in screenshot.

What is predictive programming and how it is used to manipulate our ideas about the future

Sunday, May 20th, 2012

what-is-predictive-programming

What is Predictive Programming?

Predictive programming is a subtle form of psychological conditioning provided by the media to acquaint the public with planned societal changes to be implemented. If and when these changes are put through, the public will already be familiarized with them and will accept them as 'natural progressions'; thus lessening any possible public resistance and commotion. Predictive programming therefore may be considered as a veiled form of preemptive mass manipulation or mind control.

Here are few youtube videos pretty well showing some major all main stream youth culture know movies like the Matrix, Fight Club and Star Trek that has a rich predictive programming embedded:


 

Predictive Programming of Mind Control by Media


 

Hollywood's Agenda 1 – Predictive Programing and Hidden in Plain Sight

The propaganda in the movies is clear:

New World Order, dictatorship, an upcoming human saviour Messiah and everything we know prophecies in the Holy Bible by the elders and the saints and the saint Living Orthodox Christian books.

Predictive programming is not only in the hollywood produced high budget movies, its also widely used in the TV news and games like X Factor and many many more …
There is plenty of interesting info on the subject, but be careful as it is very addictive. At the end nomatter what kind of secret agenda lays in all this mass medias to imply us ideas on possible future events or possible future gadgets economic systems or whatever it is still up to God to allow any of the agendas to come to reality.

One major methodology used in almost all brainwashing pre-conditoning, predictive programming is the so called Hegelian Dialectics claiming the foruma ( A + B = C)

Thesis + Antithesis = Synthesis

The Hegelian Dialectic visual Diagram Thesis and Anthisis equals Synthesis

The scenarios in most movie or news is like that.

First they show you something making a Thesis (Let's say – The Dolly ship first cloned animal), then they show develop an Anti-Thesis (Big money are paid for people to criticize on the dangers of mass animal cloning), then after a while there is synthesis = (The mass animal cloning is dangerous but necessery and therefore OKAY so we will clone.). The same scenario is repeated again and again myriad of times. For the unknowing observer, all the 'trial' looks perfectly legid…

Communism was one good example of a Regime that people thought will continue forever and every country sooner or later could become communist. The facts years after is clear Communism is pure Utopia and even though the regime was so strong it failed 🙂 So we should not worry too much and 'we should not our hearts be  troubled' by this unwalful stuff being around, but we should be aware of it and next time we're told this in school or university and claimed as being okay we should oppose it as TRUE CHRISTIANS. At the end God is in control as we read in the Holy Bible, so nomatter happens if we trust God and pray for his mercies, he will never forsake us.

 

10 must know and extremely useful Linux commands that every sys admin should know

Tuesday, July 30th, 2013

10 must know extremely useful gnu linux command line tools tips and tricks
There are plenty of precious command line stuff every admin should be aware on Linux. In this article I just decided to place some I use often and are interesting to know. Below commands are nothing special and probably many of experienced sys admins already know them. However I'm pretty sure novice admins and start-up Linux enthusiasts will find it useful. I know there much more to be said on the topic. So anyone is mostly welcome to share his used cmds.
 
1. Delete all files in directory except files with certain file extension

It is good trick to delete all files in directory except certain file formats, to do so:

root@linux:~# rm !(*.c|*.py|*.txt|*.mp3)

2. Write command output to multiple files (tee)

The normal way to write to file is by using redirect (to overwrite file) ">" or (to append to file) ">>";. However when you need to write output to multiple files there is a command called tee, i.e.:

root@linux:~# ps axuwwf | tee file1 file2 file3

3. Search for text in plain text file printing number of lines after match

Whether you need to print all number of lines after match of "search_text" use:

root@linux:~# grep -A 5 -i "search_text" text_file.txt

4. Show all files where text string is matched with GREP (Search for text recursively)

Searching for text match is extremely helpful for system administration. I use  grep recursive (capability) almost on daily basis:

root@websrv:/etc/dovecot# grep -rli text *
conf.d/10-auth.conf
conf.d/10-mail.conf
dovecot.conf

-l (instructs to only print file names matching string), -r (stands for recursive search), and -i flag (instructs grep to print all matches  inogoring case-sensitivity ( look for text nomatter if with capital or small letters)

5. Finding files and running command on each file type matched

In Linux with find command it is possible to search for files and run command on each file matched.
Lets say you we want to look in current directory for all files .swp (temporary) files produced so often by VIM and wipe them out:

root@linux:~# find . -iname '*.swp*' -exec rm -f {} \;

6. Convert DOS end of file (EOF) to UNIX with sed

If it happens you not have dos2unix command installed on Linux shell and you need to translate DOS end of file (\r\n – return carriage, new line) to UNIX's (\r – return carriage)), do it with sed:

root@linux:~# sed 's/.$//' filename

7. Remove file duplicate lines with awk:

cat test.txt
test
test
test duplicate
The brown fox jump over ...
Richard Stallman rox

root@linux:~# awk '!($0 in array) { array[$0]; print }' test.txt
test
test duplicate
The brown fox jump over ...
Richard Stallman rox

To remove duplicate text from all files in directory same can be easily scripped with bash for loop:

root@linux:~# for i in *; do
awk '!($0 in array) { array[$0]; print }' $i;
done

8. Print only selected columns from text file

To print text only in 1st and 7th column in plain text file with awk:

root@linux:~# awk '{print $1,$6;}' filename.txt ...

To print only all existing users on Linux with their respective set shell type:

root@linux:~# cat /etc/passwd|sed -e 's#:# #g'|awk '{print $1,$6;}'

9. Open file with VIM text editor starting from line

I use only vim for console text processing, and I often had to edit and fix file which fail to compile on certain line number. Thus use vim to open file for writing from necessary line num. To open file and set cursor to line 35 root@linux:~# vim +35 /home/hipo/current.c

10. Run last command with "!!" bash shorcut

Lets say last command you run is uname -a:

root@websrv:/home/student# uname -a
Linux websrv 3.2.0-4-686-pae #1 SMP Debian 3.2.46-1 i686 GNU/Linux

To re-run it simply type "!!":

root@websrv:/home/student# !!
uname -a
Linux websrv 3.2.0-4-686-pae #1 SMP Debian 3.2.46-1 i686 GNU/Linux

root@websrv:/home/student#

 

How to change Exim mail server hostname on Debian Linux

Tuesday, March 19th, 2013

If you have to configure Exim mail server to act as RELAY Forwarding SMTP through another mail server and nomatter, you set up in dpkg-reconfigure exim4-config command a hostname still connecting to localhost port 25 shows a hostname identical as configured hostname for server. You will have to explicitly instruct exim to desired hostname like so:

debian:~# cp -rpf /etc/exim4/exim4.conf.template /etc/exim4/exim4.conf

Then edit /etc/exim4/exim4.conf

Add somewhere in beginning of config file

primary_hostname = DESIRED_HOSTNAME.COM

To make exim load new settings, restart SMTP:

debian:~# /etc/init.d/exim4 restart

Stopping MTA for restart: exim4_listener.
Restarting MTA: exim4.
 

debian:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 DESIRED_HOSTNAME.COM ESMTP Exim 4.72 Tue, 19 Mar 2013 19:02:52 +0000
^]
telnet> quit
Connection closed.

 

Nativity of Christ (Christmas) in Orthodox Church 24-th against 25-th December and 6-th against 7-th January – Spreading good news of Christ birth twice

Monday, January 7th, 2013

Ancient icon of Nativity of Christ Mount Sinai 7-th 9-th-century Rojdestvo Hristovo pravoslavna ikona - celebrating feast twice double spreading the good news of Christ's birth

In Serbian and Russia and Jerusalem as well as Orthodox Church January 6th against 7th  eve is Nativity (The day in which we Orthodox Christians, celebrate The Incarnation (Birth) of Christ).

In the Orthodox Church, there are some Orthodox Churches who celebrate Nativity on 24th against 25-th December (Bulgaria, Greece, Romania etc.) and some who celebrate Nativity on 6-th against 7-th January (Russia, Jerusalem, Syria, Serbia, Ethiopia, Egypt  etc.) . The reason for this is some  autocephalous (nation wide) Orthodox Churches use the so called New dates Church calendar, and others are still using the Old Calendar. Nomatter that all Orthodox Churches are in eucharistic (sacramental) communion and celebrate Easter on one and same date. The feast of birth of Christ was known to be originally celebrated on 24-th against 25-th of December (but this was according to the previous dates calendar used in the world which was based on the moon phases). After whole the world accepted and use even till now the so called Gregorian Church calendar, which is said to be more mathematically precise some of the national Orthodox Churches, with the usual consent between all nation Orthodox Church Patriarchates decided to move the 24-th against 25-th December to be celebrated on 24 to 25-th eve to be more accurate with the world dates calendar used by all throughout the world. This same 24-th against 25-th of December according to the old world dates calendar which was used in most Christian countries before the Gregorian calendar become the de-facto standard for world calendar coincides with  6-th against 7-th December.

There was quite a talk going around between people who were for and against the 24-th and 25-th calendar, as in all Orthodox Churches until the 1950/60 Nativity of Christ was celebrated on 6-th against 7-th January. Now there are two camps of people in the one Holy Apostolic Orthodox Church, those for the new calendar and those against it.

Nativity of Christ Rojdesetvo hristovo Christmas 24-th against 25-th December and 6-th against 7th-January both correct and unifying the One Holy Apostolic Orthodox Church
Actually in practice following Christmas on both date is not incorrect, and it should be mentioned in very ancient times of the Church, Nativity of Christ was celebrated every-day as Church services were continuing 10 to 12 hours each day!!!! Thus in ancient Church, there was not a special day for a birthday of Christ, but it was known in the Church Christ for sure Christ was born in December, many saints (if not mistaken) including st. John of Chrysostom said 24-th eve is the correct date on which the most pure Mother of God Virgin Mary gave birth to our savior and Messiah (Christ).
 
No-matter about the date, even as situation now is where some Churches celebrate Christmas on 24th eve and some on 6th against 7th this should not be perceived as separation of the Church, but as point of unification and increasing of possibility of people to hear about the birth of the savior of us the sinful humanity. As the good news of Nativity is preached and heard by unbelievers and believers twice the year instead of just one, making the world remember twice about the moment in which we received the news for hope of redemption and salvation from the corruption of death that ruled over us before Christ's incarnation and salvation mission on earth.

 

The Living of Saint Peter and Saint Fevronia – a fascinating Russian cartoon retelling the saints story

Monday, March 26th, 2012

Saint Peter and Fevronia Orthodox Christian saints protector of happy family, love and blessed marriage

The anime Living Story of Saint Peter and Saint Fevronia is a modern story remake of an ancient Church living of two bright Russian saints.
The official movie genre is orthodox christian kids animation movie.
The 14 minutes cartoon re-tolds the living story of St. Peter and st, Fevronia in a playful and entertaining way like for kids or youngsters.
Nomatter the movie primary target audience is children, the cartoon is great to see for adults people as well :).
The movie genre is orthodox christian kids animation movie.
The plot is based on a true (historic record) story of two saints venerated each year across Orthodox Churches around the world.

The original story I watched was a Bulgarian translation from Russian. But since I found it to be so valuable, I look for a translated video and got one in youtube.Take 14 minutes break and watch it, I'm sure you will like it so much, that probably give it a second time glimpse alone or with your wife, children or girlfriend.

Unfortunately, the english title is mis-translated as it says "Tale" and not "Story" and there is difference in meaning between this two words.
It is not tale as tale is made up story and this is not a made story but a story based on the two saints who lived in the end of 12 and beginning of the thirteen century.
Here is in short the real Church living:
The two saints were living in Murom Russia. Peter was prince and Fevronia a poor maid a daughter of a beekeeper who made his family living by collecting wild honey in the forest.

Prince Peter was striken by a severe sickness and in a vision it was revealed to him, that the only one that can cure him is Fevronia (a village maid living in the village of Laskovo Russia. The prince went to her and since he saw she is a pious, good and wisdom rich maid promised her, if she manage to heal him to take her as a bride to his place.
By her warm prayers to God and herbs, Fevronia succeeded in healing the prince sickness. Being fully restored st.Peter changed his mind and wanted to break his promise to marry her, cause the young made not part of the aristocratic Russian society. He didn't yet reached his home and the sickness, came back. This time with a deep repentance, he came back to Fevronia and she cured him again. Then the prince merried her and made her a princess of Murom
 

St. Peter and Fevronia Orthodox Church saints protector of marriage

However there love in Christ had to went through high temptations. Once the couple married, the prince proud boyars requested the prince to leave his new bride, as they didn't wanted to accept a simple girl as Fevronia will be governing them. Being in uneasy situation prince Peter prefered to leave his governing power and castle but to stay with his life. Together by boat by the near river Oka they left the kingdom. Soon after Gods wrath came Murom because of people's rebellion and the people requested the chased prince family to be restored to power.
Pushed by the peasents, the boyars bringed back the couple to power. The two saints governed their kingdom with great wisdom, love and mercy to the people.

In their old age the decided to become monks in separate monasteries. St. Peter received his new monk name David and princess Fevronia took the nun name Evphrosia (Evfrosia). Even living a sepate monk / nun life the couple continued having a deep love to each other and asked God to take them from this earthly life on the same date. God answered their prayer granting them to depart this earth on the same day in the same hour!
Like in life even in death people tried to separate them.
Fevronia was put in a coffin in the nun monastery, where Peter was prepared for a monk funeral in the man monastery and they put them in separate graves.
In the morning the graves were empty and their bodies were found buried together in one grave. People realized it is Gods will they are buried together and left them buried together. Today the incorruptable bodies of the two saints can be seen and venerated in Holy Trinity's nun monastery in the town of Murom Russia. St. Peter and St. Fevronia are considered patron of the Christian marriage, couple's love and family happiness.
It is common that many young people are, asking for the two saints prayer intercession in front of God for getting a good spouse in life and good marriage.

Also the two saints are oftenly asked for prayer for improving a marriege bindings.
The two saints feast day is like the Orthodox Antipode of the Roman Catholic feast of couples in love – St. Valentine.

As you see, St. Peter and St. Fevronia living is full of wisdom and true spirituality, and there is plenty we the modern disbelieving people can learn from it.
Let God by the two saints holy prayers have mercy on us.

How to delete million of files on busy Linux servers (Work out Argument list too long)

Tuesday, March 20th, 2012

How to Delete million or many thousands of files in the same directory on GNU / Linux and FreeBSD

If you try to delete more than 131072 of files on Linux with rm -f *, where the files are all stored in the same directory, you will get an error:

/bin/rm: Argument list too long.

I've earlier blogged on deleting multiple files on Linux and FreeBSD and this is not my first time facing this error.
Anyways, as time passed, I've found few other new ways to delete large multitudes of files from a server.

In this article, I will explain shortly few approaches to delete few million of obsolete files to clean some space on your server.
Here are 3 methods to use to clean your tons of junk files.

1. Using Linux find command to wipe out millions of files

a.) Finding and deleting files using find's -exec switch:

# find . -type f -exec rm -fv {} \;

This method works fine but it has 1 downside, file deletion is too slow as for each found file external rm command is invoked.

For half a million of files or more, using this method will take "long". However from a server hard disk stressing point of view it is not so bad as, the files deletion is not putting too much strain on the server hard disk.
b.) Finding and deleting big number of files with find's -delete argument:

Luckily, there is a better way to delete the files, by using find's command embedded -delete argument:

# find . -type f -print -delete

c.) Deleting and printing out deleted files with find's -print arg

If you would like to output on your terminal, what files find is deleting in "real time" add -print:

# find . -type f -print -delete

To prevent your server hard disk from being stressed and hence save your self from server normal operation "outages", it is good to combine find command with ionice, e.g.:

# ionice -c 3 find . -type f -print -delete

Just note, that ionice cannot guarantee find's opeartions will not affect severely hard disk i/o requests. On  heavily busy servers with high amounts of disk i/o writes still applying the ionice will not prevent the server from being hanged! Be sure to always keep an eye on the server, while deleting the files nomatter with or without ionice. if throughout find execution, the server gets lagged in serving its ordinary client requests or whatever, stop the execution of the cmd immediately by killing it from another ssh session or tty (if physically on the server).

2. Using a simple bash loop with rm command to delete "tons" of files

An alternative way is to use a bash loop, to print each of the files in the directory and issue /bin/rm on each of the loop elements (files) like so:

for i in *; do
rm -f $i;
done

If you'd like to print what you will be deleting add an echo to the loop:

# for i in $(echo *); do \
echo "Deleting : $i"; rm -f $i; \

The bash loop, worked like a charm in my case so I really warmly recommend this method, whenever you need to delete more than 500 000+ files in a directory.

3. Deleting multiple files with perl

Deleting multiple files with perl is not a bad idea at all.
Here is a perl one liner, to delete all files contained within a directory:

# perl -e 'for(<*>){((stat)[9]<(unlink))}'

If you prefer to use more human readable perl script to delete a multitide of files use delete_multple_files_in_dir_perl.pl

Using perl interpreter to delete thousand of files is quick, really, really quick.
I did not benchmark it on the server, how quick exactly is it, but I guess the delete rate should be similar to find command. Its possible even in some cases the perl loop is  quicker …

4. Using PHP script to delete a multiple files

Using a short php script to delete files file by file in a loop similar to above bash script is another option.
To do deletion  with PHP, use this little PHP script:

<?php
$dir = "/path/to/dir/with/files";
$dh = opendir( $dir);
$i = 0;
while (($file = readdir($dh)) !== false) {
$file = "$dir/$file";
if (is_file( $file)) {
unlink( $file);
if (!(++$i % 1000)) {
echo "$i files removed\n";
}
}
}
?>

As you see the script reads the $dir defined directory and loops through it, opening file by file and doing a delete for each of its loop elements.
You should already know PHP is slow, so this method is only useful if you have to delete many thousands of files on a shared hosting server with no (ssh) shell access.

This php script is taken from Steve Kamerman's blog . I would like also to express my big gratitude to Steve for writting such a wonderful post. His post actually become  inspiration for this article to become reality.

You can also download the php delete million of files script sample here

To use it rename delete_millioon_of_files_in_a_dir.php.txt to delete_millioon_of_files_in_a_dir.php and run it through a browser .

Note that you might need to run it multiple times, cause many shared hosting servers are configured to exit a php script which keeps running for too long.
Alternatively the script can be run through shell with PHP cli:

php -l delete_millioon_of_files_in_a_dir.php.txt.

5. So What is the "best" way to delete million of files on Linux?

In order to find out which method is quicker in terms of execution time I did a home brew benchmarking on my thinkpad notebook.

a) Creating 509072 of sample files.

Again, I used bash loop to create many thousands of files in order to benchmark.
I didn't wanted to put this load on a productive server and hence I used my own notebook to conduct the benchmarks. As my notebook is not a server the benchmarks might be partially incorrect, however I believe still .they're pretty good indicator on which deletion method would be better.

hipo@noah:~$ mkdir /tmp/test
hipo@noah:~$ cd /tmp/test;
hiponoah:/tmp/test$ for i in $(seq 1 509072); do echo aaaa >> $i.txt; done

I had to wait few minutes until I have at hand 509072  of files created. Each of the files as you can read is containing the sample "aaaa" string.

b) Calculating the number of files in the directory

Once the command was completed to make sure all the 509072 were existing, I used a find + wc cmd to calculate the directory contained number of files:

hipo@noah:/tmp/test$ find . -maxdepth 1 -type f |wc -l
509072

real 0m1.886s
user 0m0.440s
sys 0m1.332s

Its intesrsting, using an ls command to calculate the files is less efficient than using find:

hipo@noah:/tmp/test$ time ls -1 |wc -l
509072

real 0m3.355s
user 0m2.696s
sys 0m0.528s

c) benchmarking the different file deleting methods with time

– Testing delete speed of find

hipo@noah:/tmp/test$ time find . -maxdepth 1 -type f -delete
real 15m40.853s
user 0m0.908s
sys 0m22.357s

You see, using find to delete the files is not either too slow nor light quick.

– How fast is perl loop in multitude file deletion ?

hipo@noah:/tmp/test$ time perl -e 'for(<*>){((stat)[9]<(unlink))}'real 6m24.669suser 0m2.980ssys 0m22.673s

Deleting my sample 509072 took 6 mins and 24 secs. This is about 3 times faster than find! GO-GO perl 🙂
As you can see from the results, perl is a great and time saving, way to delete 500 000 files.

– The approximate speed deletion rate of of for + rm bash loop

hipo@noah:/tmp/test$ time for i in *; do rm -f $i; done

real 206m15.081s
user 2m38.954s
sys 195m38.182s

You see the execution took 195m en 38 secs = 3 HOURS and 43 MINUTES!!!! This is extremely slow ! But works like a charm as the running of deletion didn't impacted my normal laptop browsing. While the script was running I was mostly browsing through few not so heavy (non flash) websites and doing some other stuff in gnome-terminal) 🙂

As you can imagine running a bash loop is a bit CPU intensive, but puts less stress on the hard disk read/write operations. Therefore its clear using it is always a good practice when deletion of many files on a dedi servers is required.

b) my production server file deleting experience

On a production server I only tested two of all the listed methods to delete my files. The production server, where I tested is running Debian GNU / Linux Squeeze 6.0.3. There I had a task to delete few million of files.
The tested methods tried on the server were:

– The find . type -f -delete method.

– for i in *; do rm -f $i; done

The results from using find -delete method was quite sad, as the server almost hanged under the heavy hard disk load the command produced.

With the for script all went smoothly. The files were deleted for a long long time (like few hours), but while it was running, the server continued with no interruptions..

While the bash loop was running, the server load avarage kept at steady 4
Taking my experience in mind, If you're running a production, server and you're still wondering which delete method to use to wipe some multitude of files, I would recommend you go  the bash for loop + /bin/rm way. Yes, it is extremely slow, expect it run for some half an hour or so but puts not too much extra load on the server..

Using the PHP script will probably be slow and inefficient, if compared to both find and the a bash loop.. I didn't give it a try yet, but suppose it will be either equal in time or at least few times slower than bash.

If you have tried the php script and you have some observations, please drop some comment to tell me how it performs.

To sum it up;

Even though there are "hacks" to clean up some messy parsing directory full of few million of junk files, having such a directory should never exist on the first place.

Frankly, keeping millions of files within the same directory is very stupid idea.
Doing so will have a severe negative impact on a directory listing performance of your filesystem in the long term.

If you know better (more efficient) ways to delete a multitude of files in a dir please share in comments.