Posts Tagged ‘thing’

Fix “There Has Been a Critical Error on Your Website” wordpress error

Friday, December 2nd, 2022

there-has-been-a-critical-error-on-your-website-wordpress-critical-error-fix

Say you have a shiny working WordPress based website withtout any monitoring set for years but suddenly, you open the site and you get the terrifying error:
 

There Has Been a Critical Error on Your Website

That is quite of a stress for sure. As in the first few minutes you don't understand how this has happened since, you did not touched the perfeclty working site for a very, very long time.
Then you start to debug into the apache / nginx access.log, error.log and mysql mysql.err etc. franticly trying to figure it out the normal ideas pop-up immediately into mind, whether you have a recent backup for the website's database. If you have pair of high availability webservers service or backup databases that serve the traffic via a separate standby instance of the service, you might try to switch off the official service and see whether the standby Webserver / SQL server instance would serve the website fine.
However, if this is not an option and you have no standby backup service as a recovery Plan B option already set. Your only option is to continue to debug what is wrong.
Then the next thing to do is to check whether you don't have a Web Caching or Proxy in front of your webservers that are preventing you to see a recent version of the website and give you some old cache or you don't have an ISP proxy that is giving you some unreal results. That is easily seenable from the Webserver logs. If this is neither the case the next thing is to:
 

Enable WordPress (wp-config.php) Debug mode

By default for Security reasons the WordPress PHP execution debug mode is switched off inside wp-config.php.
When there are odd pages with the WordPress based blog or site however this can easily be changed by modifying the WP_DEBUG true|false value.

To do so edit with a text editor such as vim / nano / mcedit  wp-config.php or if no SSH access to the remote machine, use SFTP / FTP transfer protocol copy the file to your desktop and inspect it and make sure the WP_DEBUG / WP_DEBUG_DISPLAY / WP_DEBUG_LOG has following values:

define( 'WP_DEBUG', true );

define( 'WP_DEBUG_DISPLAY', false );

define( 'WP_DEBUG_LOG', true );

Reloading the Browser window tab with There is a critical error on Your website, you should get some Errors or Warnings like:
 

Warning: Illegal string offset 'parent_slug' in /var/www/websitecom/wp-content/plugins/photo-gallery/booster/main.php on line 180

Warning: Illegal string offset 'slug' in /var/www/websitecom/wp-content/plugins/photo-gallery/booster/main.php on line 180

 

Then you can temporary disable the problematic problem in that case for example the photo-gallery and recheck the website, and then restore from backup snapshot the respective plugin files version from a moment, when the website was working.

If this doesn't solve it and more plugins are crashing and you can't find an easy way to work-around it you miss a backup, you might try to

 

Disable all WordPress active plugins

Disable your plugins from the dashboard, visit Plugins > Installed Plugins and tick the checkbox at the top of the list to select them all.
Then click Bulk Actions -> Deactivate, which should be enough to disable any conflicts and restore your site.

You can do essentially the same thing through SSH / FTP session.

Step 1: Log in to your site with SSH / FTP.
Step 2: Open the wp-content folder to find your plugins.
Step 3: Rename the plugins folder to plugins_old and verify that your site is working again via SSH run commands:

# cd  path_to/plugins; mv plugins plugins_old

or rename via FTP client
Step 4: Rename the folder back to “plugins”. The plugins should be disabled still, so you should be able to log in to your dashboard and activate them one by one. If
the plugins reactivate automatically, rename individual plugin folders with _old until your site is restored.

Raise the PHP Memory Limit

Sometimes, a low PHP limitation causes critical errors on WP based blogs and sites, if necessery raise up the memory limitation via:

define( 'WP_MEMORY_LIMIT', '128M' );

Change Max Upload File Size and Text Processing function limits

To increase the max upload file size, add this code to wp-config.php:

ini_set('upload_max_size' , '256M' );

ini_set('post_max_size','256M');

And to fix the breaking of large pages on your site, add this code:

ini_set('pcre.recursion_limit',20000000);
ini_set('pcre.backtrack_limit',10000000);

Clear up any caches

If you use some session caching of the website on the machine such as memcached / ncache / redis / varnish or an haproxy or any proxy in front of the webserver to do some kind of High availability could produce strange  unexpected Critical errors on Your Website, thus restarting such services or cleaning up any cache would be advisable if you have such.
 

What Causes "There Has Been a Critical Error on Your Website" error?


The reason could be practically anything as WP is a kind of multi-comonent free and a bit of bloatware. The general ones could be  from a missing database table / table fields to a messed up plugin after update a disappeared critical plugin or essential wordpress PHP file, but in my specific case the reason was simple the Plugins Auto-update, which I have had the stupidity to enable.

The WordPress Automatic Updates, though saving you effort and Protecting your website in most cases against recent bugs and Exploits and increasing the WP security level, often causes issues and from my personal experience it is not recommended so better avoid it. Again next time you implement any automation to your server make sure you put some kind of monitoring.

Even if you decide to enable it make sure you do it the right way and not like me, by enabling some Monitoring to the WordPress site via Zabbix / Nagios / Cacti / monit  etc to be sure you get notified immediately if the WordPress based site is down.

How to check Microsoft IIS webserver version

Monday, July 21st, 2014

If you have to tune some weirdly behaviour Microsoft IIS (Internet Information Services) webserver, the first thing to do is to collect information about the system you're dealing with – get version of installed Windows and check what kind of IIS version is running on the Windows server?

To get the version of installed Windows on the system you just logged in, the quickest way I use is:
 

Start -> My Computer (right mouse button) Properties

check-windows-server-version-screenshot-windows-2003-r2

Run regedit from cmd.exe and go and check value of registry value:

 

HKEY_LOCAL_MACHINE\SOFTWARE\MicrosoftInetStp\VersionString


check-iis-webserver-version-with-windows-registry-screenshot

As you can see in screenshot in this particular case it is IIS version 6.0.

An alternative way to check the IIS version in some cases (if IIS version return is not disabled) is to telnet to webserver:

telnet your-webserver 80
 


Once connected Send:

HEAD / HTTP/1.0


Also on some Windows versions it is possible to check IIS webserver version from Internet Information Services Management Cosnole:

To check IIS version from IIS Manager:

Start (button) -> Control Panel -> Administrative Tools -> "Internet Information Services" IIS Manager

From IIS Manager go to:

Help -> About Microsoft Management Console


Here is a list with most common IIS version output you will get depending on the version of Windows server:

 

Windows NT 3.51 1.0
Windows NT 4 2.0-4.0
Windows Server 2000 5.0
Windows XP Professional 5.1
Windows Server 2003 6.0
Windows Vista 7.0
Windows Server 2008 7.0
Windows Server 2008 R2 7.5
Windows 7 7.5
Windows Server 2012 8.0
Windows 8 8.0
Windows Server 2012 R2 8.5
Windows 8.1 8.5

If you have only an upload FTP access to a Folder served by IIS Webserver – i.e. no access to the Win server running IIS, you can also grasp the IIS version with following .ASP code:
 

<%
response.write(Request.ServerVariables("SERVER_SOFTWARE"))
%>


Save the file as anyfile.asp somewhere in IIS docroot and invoke it in browser.

The Color of Pomegranates (1968) фильм “Цвет граната”/Նռան գույնը (1969г.)

Thursday, April 11th, 2013

Those who enjoy post-modern art and odd movies should definitely check out The Color of Pomegranates. This movie is one among top Greatest Soviet Movies. There is a saying in Bulgaria "Is the movie Good or Russian?". In terms of surrealism in movie genre most of Soviet produced movies hit 10. In terms of normal viewer they're almost impossible to understand and very unimportant. The good thing about the movie is it shows some traditional things from some of ex USSR countries. Anyways I don't like the paganism in movie. Few of the Christian old paintings and things are worthy to see.


 

The Color of Pomegranates (1968) фильм "Цвет граната"/Նռան գույնը (1969г.)

The Real reason for the Global Economic Crisis – An Ethical and Moral business relations can recover world economy

Tuesday, April 10th, 2012

So many people, are asking themselves these days the great question:

 

What is the reason for this terrible world crisis?

Its trendy to speculate the reason for the crisis is the downturn in local countries economies.

Though its a fact there is a strong relation between the crisis and the countries economic downturn. Having defined a certain economy being in a downturn does not explain the root of the economic problem.
Defining the economic crisis being there is just like defining the symptom of a disease without knowing the exact disease type.
Hence talking about economic crisis and how severe it is severeness, many companies news agencies and radios make a good money by creating all the time sensational news build on top of warped "half truths".

This news however rarely reflect the reality "as it is" but mostly concentre on some fictionous idea of the journalist about the real economic situation. The end result is spreading of mass dilusion, fear uncertainty and doubt in citizens mind.

Not much are aware the true meaning of Crisis and the words origin, therefore its worthy to explain what is the real meaning of crisis
 

Crisis word origin is derived from Ancient Greek language. Crisis word meaning translated to modern English means literally JUDGEMENT !

In the word judgement our ancestors were referring to God judgement for humanity unlawfulness. Having this perspective in mind when talking about Crisis is vital to understand our failing democracy nowdays which is based not on ancient knowledge but on man experimental framework.

Obviously the ancient, people before the era of business were wise, a wisdom we now try to completely avoid and build on our own new experimental thinking. Experimenting is a great thing but only if you build on a solid base of previous scientifically repeatable experiences.

The ancients could obviously well understand the reason for a a local or global crisis's stems from the in-justice in money / trade relations between individuals.

With all said the best thing our companies and we as business people should do today is go back to the ancients knowledge and start doing business ethical and avoid deception and lies. Otherwise God will never bless the businesses of people and we will be under the continuous crisis for more and more until, we repent and realize that unethical behavior (not following the righteousness in relations) will never bring us good.
 

A proof Islam is false religion not pleasable to God? 717 people died during Hajj in Mecca on Greatest Muslim feast Kurban Bayrami

Friday, September 25th, 2015

The frequent deaths in Mecca in Muslim Islamic Hajj a proof islam is a false religion

This year on 24 September, for one more time on the day of Greatest Muslim feast Eid-Al-Adha in turkey known as Kurban Bayrami (translated as Feast of Sacrifice) Saudi Arabia's Hajj (during the veneration of the greatest Muslim relic Kaaba (stone)  in Mecca (said to be the birth place of Muhammad), again at least  717 poor people were killed (crushed to death) and 863 injured during Hajj's common million muslim people's prayer gathering. |

Sadly Incidents like this for Muslim pilgrims are not news and they happen quite often sadly and if taken the statistics of death toll of pilgrims for the past years is shocking.

Here are some statistics on the latest 25 years of deaths of pilgrims on a Hajj travel or those who directly died in Mecca:

Mosquee_Masjid_el_Hara_a_Mecque
 

Some notable incidents during Hajj and Mecca pilgrimages in the last 25 years include:
 

  • July 2, 1990: A stampede inside a pedestrian tunnel (Al-Ma'aisim tunnel) leading out from Mecca towards Mina and the Plains of Arafat led to the deaths of 1,426 pilgrims, many of them of Malaysian, Indonesian and Pakistani origin.[2][3]
  • May 23, 1994: A stampede killed at least 270 pilgrims at the stoning of the Devil ritual.
  • April 9, 1998: at least 118 pilgrims were trampled to death and 180 injured in an incident on Jamarat Bridge.[4]
  • March 5, 2001: 35 pilgrims were trampled to death in a stampede during the stoning of the Devil ritual.[5]
  • February 11, 2003: The stoning of the Devil ritual claimed 14 pilgrims' lives.[6]
  • February 1, 2004: 251 pilgrims were killed and another 244 injured in a stampede during the stoning ritual in Mina.[7]
  • January 12, 2006: A stampede during the stoning of the Devil on the last day of the Hajj in Mina killed at least 346 pilgrims and injured at least 289 more. The incident occurred shortly after 13:00 local time, when a busload of travellers arrived together at the eastern access ramps to the Jamarat Bridge. This caused pilgrims to trip, rapidly resulting in a lethal stampede. An estimated two million people were performing the ritual at the time.
  • September 24, 2015: 717 pilgrims were killed and another 800 injured during a stampede in the 2015 Hajj


The Kabba stone is the central pilgrimage place for muslims and accoriding to Islam faith it is a stone which came from heaven, there are pleny of legends and superstitious speculations regarding this stone circulating among muslims and it is hard to say which is really true, however what is sure is Hajj on Mecca has been practiced by muslims since the early days of Islam even to this very day.

From a Christian staind point going to venerate a stone is simply a venerating an idol (as a stone is a creation) and not the creator and is very different from us Christians venerating the icons, as we venerate not the icon itself but the image of personality depicted on it The Lord Jesus Christ (Christ meaning Messiah), The Most holy Theotokos Virgin Mary, John the Baptist the Angels, Archangels and Saints who immitated Christ's life and who reached immerse holines even in this life being able to perform miracles.

Tomb-of-Islam-creator-Mohammad

One really strange thing which I guess no muslim could answer is why if Muhammad was the greatest and last prophet of Allah, he did not perform any miracles in lifetime or after death. Another thing is the veneration of the grave of Muhammad (At the Green Dome) practiced in Islam that is a really strange thing and contradicts the laws of the Qu'ran instructing not to venerate anything except Ala.

I would say the main proof against Islam as being the right faith in God is the fact Muhammad died like every normal person. The greatest venerated prophet for 1.5 billion muslims more venerated even than the Isa's Allah messanger (Isa is Jesus's name in Qu'ran) died like every normal person with a peaceful death without any super-natural indication he was a prophet after his death.

In Christianity we believe in the Lord Jesus Christ as the son of God (The Father the Son and the Holy Spirit) which we call The Holy Trinity (a undividable unity between the 3 hyposthasis.
The proof for us Christians that Jesus Christ is the Son of God and Savior of Mankind is the empty Tomb (Grave of Christ), because JESUS HAS RISEN AND WITH BODY IN HEAVEN!
 

It is interesting that these bright days for muslims often end up with immerse sorrow for some families which loose beloved husbands in accidents like this.

Interestingly on Christian Easter feast be it Roman Catholic or Eastern Orthodox there is no records of tragic incidents.
Even it can be considered a miracle that on Eastern feasts in Jerusalem's Church of Resurrection where the Lord Jesus Christ has been risen (resurrected) from the dead there are no crushing incidents even though the big crowds, neither there are any burned people even though the whole Holy Sepulchure (Resurrection) church is filled with people holding lighted up candles with the every year reoccuring of Miracle Holy Fire.

The_Ressurrection_of_Christ-orthodox-icon

The lack of incidents on The day of the Resurrection of the Lord Jesus Christ (Eastern) in my humble opionion is a clear sign that this feast is a pleasing God.

Muslims believe and claim that it is the greatest joy of all to die for (God) Allah and those incidents are sent blessing from Allah for those who died in those incidents and in a sense dying for God is a blessing if you die for God's sake as a martyr while testifying faith in God but being killed while you're on a way to venerate God seems a bit illogical to me.
I have red the Holy Bible Old Testament as well as the Qu'ran sometimes ago two books which more or less are being regarded by muslims and in none of them I found not a story of someone on the way to pilgrim God or who have promised to pilgrim God who have been killed, so I guess this kind of thinking is an invention of Mullam / Imams who try to justify the event and make it look beneficial for islaam, a justification which I believe most of people looking for truth and non muslims would never justity.

Crucifixion_by_Theophanes_the_Cretan

From a my view point the crushment of people during a pilgrimage is a clear sign God's Grace and Holy Angels doesn't guard the place but the devil is let to often kill those poor people because of the rejection of muslims of the true Light the Lord Jesus Christ as a true Son of God and a saviour of the Lord who came to give his holy life on the cross not only for Christians who believed in him but for all People from all religions in the world from all ages including the direct descending from Muhammad (as I heard from some Kurdish muslim people) Muslim.

I pray our Lord Jesus Christ to have mercy on the  souls of all this Mecca pilgrimages who died yesterday and the in the past accidents through the years and to have mercy and open the spiirtual eyes of Muslim around the world and enlighten them with the truthful word of the Holy Gospel.

 

The Advantages Of Using Free Software Instead Of Proprietary One

Saturday, February 17th, 2007

I almost forgot. We had to do a presentation in the College on a free theme I choosed “The Advantages Of Using Free Software Instead Of Proprietary One” from this link you can check was all about Free Software Advantages Presentation .
The presentation went smoothly as a whole the only problem was that my collegues had no really idea what is all this about. The good thing is that the Business Communication teacher said the theme is really interesting and likes what I did. God was merciful also to give me a peace during the whole presentation thing.
Thank you LORD.
There is also a plain text version of the presentation which can be seen here END—–

Linux: List last 10 (newest) and 10 oldest modified files in a directory with ls

Tuesday, April 8th, 2014

An useful thing on GNU / Linux sometimes is to list last or oldest modified files in directory.

Lets say you want to list last 10 modified files with ls from today / yesterday. Here is how:
 

ls -1t | head -10
my.cnf
wordperss_enabled_plugins.txt
newcerts/
mysql-hipo_pcfreakbiz.dump
NewArchive-Jan-10-15.zip
hipo_pcfreakbiz-mysqldb-any-out-1389361234.tgz
Tisho_Snimki/
wordpress/
wp-cron.php?doing_wp_cron=1.1
wp-cron.php

 

To list 10 oldest modified files on Linux:

 

ls -1t | tail -10
    my.cnf
    pcfreak_sql-15_10_05_2012
    mysql-tuning-primer*
    tuning-primer.sh*
    system-administration-services.html
    blog_backup_15_07_2012.tar.gz
    www-files/
    dump.sql
    courier-imap*
    djbdns-1.05.tar.gz


Cheers 😉

What is Vertical scaling and Horizontal scaling – Vertical and Horizontal hardware / services scaling

Friday, June 13th, 2014

horizontal-vs-vertical-scaling-vertical-and-horizontal-scaling-explained-diagram

If you're coming from a small or middle-sized company to a corporations like HP or IBM probably you will not a clear defined idea on the 2 types (2 dimensions) of system Scaling (Horizontal and Vertical scaling). I know from my pesronal experience that in small companies – all needed is to guarantee a model for as less probels as possible without too much of defining things and with much less planning. Other thing is being a sysadmin in middle-sized companies, often doesn't give you opportunity to discuss issues to solve with other admins but you have to deal as "one man (machine) for all" and thus often to solve office server and services tasks you do some custom solution.
hence for novice system administrators probably it will be probably unclear what is the difference between Horizontal and Vertical Scaling?

horizontal-vertical-scaling-scale-up-and-scale-out-server-infrastructure-diagram

 

Vertical Scaling (scale vertically or scale up) :- adding more resources(CPU/RAM/DISK) to your server (database or application server is still remains one).
Vertical Scaling is much more used in small and middle-sized companies and in applications and products of middle-range. Very common example for Virtual Scaling nowdays is to buy an expensive hardware and use it as a Virtual Machine hypervisor (VMWare ESX). Where a database is involved using Vertical Scaling without use of multiple virtual machines might be not the best solution, as even though hardware might suffice (creation of database locks might impose problems). Reasons to scale vertically include increasing IOPS (Input / Ouput Operations), increasing CPU/RAM capacity, and increasing disk capacity.
Because Vertical Scaling usually means upgrade of server hardware – whenever an improved performance is targeted, even though if Virtualization is used, the risk for downtimes with it is much higher than whenever horizontal scaling.

Horizontal Scaling (scale horizontally or scale out):- adding more processing units (phyiscal machine) to your server (infrastructure be it application web/server or database).
Horizontal scaling, means increasing  the number of nodes in the cluster, reduces the responsibilities of each member node by spreading the keyspace wider and providing additional end-points for client connections. The capacity of each individual node does not change, but its load is decreased (because load is distributed between separate server nodes). Reasons to scale horizontally include increasing I/O concurrency, reducing the load on existing nodes, and increasing disk capacity.
Horizontal Scaling has been historically much more used for high level of computing and for application and services. The Internet and particular web services gave a boom of Horizontal Scaling use, most companies nowadays that provide well known web services like Google (Gmail, Youtube), Yahoo, Facebook, Ebay, Amazon etc. are using heavily horizontal scaling. Horizontal Scaling is a must use technology – whenever a high availability of (server) services are required.

Fix random reboots of ZTE Blade 3 Android and other chineese smartphones – Fix battery strange discharge after reboot

Monday, August 25th, 2014

fix-solve-random-mobile-reboots-on-chineese-Android-mobile-phones-Android_greenman_logo
I'm owning ZTE Blade 3 chineese brand mobile phone. I thought there is not a big deal to buy chineese mobile phone as it saves money but the good old saying: "The Cheap always is more expensive" came true to proof the old wisdom.

The phone runs some Android port of version 4.0.4 and generally it runs well for a couple of days, but after the increase of application the battery started discharging too quickly, I have to charge almost daily … also occasionally since I have turned synchronization of mobile phone numbers with Google  from settings the ZTE Andorid phone started to randomly loose its contacts (after which I had to restore with proprietary application Dr. Fone). After a while I realized there is another fix, sometimes Contacts restore was also possible through using free application Contacts Sync Fix, but most of the times the only thing that could resolve the contacts is to dig for lost phonebook contacts with Dr. Fone …. Eventually I realized the Lost PhoneBook Contacts issue can be resolved by itself on a random principle so the missing phones issue sometimes solved by itself just by switching off complete the phone for some time and switching it on again after 12 hours?! Recently I found another alternative way to restore sudden (deleted) disappered phone numbers by:

Settings -> Profiles and Synchronization -> (Go to configured gmail account settings) -> Settings of Profile

Then

(Frequency of syncrhonization, messaging etc.) -> (click over the email address) -> Frequency of email check (every 4 hours) 

Set the every 4 hours settings to Never and then after a minute or 2 (interval), set back the Never (opt) to every 4 hours

Since some time I started facing another more severe problem – random phone reboots after which the battery often kept at a critically low charged. The batter often fall to 40% or 50% charge from 99% / 100% charge, and after some time of talking over the phone the battery fall down to as low as 18% and in a short random time it fall to 9%, then after a reboot it uppered the charge to 35% or 45% and the oddities continued. My first guess was it could be the battery being broken, some colleagues at work advised me to completely discharge the battery so the phone couldn't boot and then try to charge it with Battery Doctor free Android Application. Battery Doctor has a special 3 stage charging:

battery-doctor-android-revolutionary-battery-3-stage-charging-or-recovering-deat-dried-out-batteries-calibrating-broken-android-phone-battery-application

1. Bulk Charge

The primary purpose of a battery charger is to recharge a battery. This first stage is typically where the highest voltage and amperage the charger is rated for will actually be used. The level of charge that can be applied without overheating the battery is known as the battery's natural absorption rate. For a typical 12 volt AGM battery, the charging voltage going into a battery will reach 14.6-14.8 volts.

Where first 80% of the battery are charged with a rapid electricity influx to battery once 80% of battery charge is reached charging is moved to the so Absorption Battery Charge

2. Absorption Charge

Smart chargers will detect voltage and resistance from the battery prior to charging. After reading the battery the charger determines which stage to properly charge at. Once the battery has reached 80%* state of charge, the charger will enter the absorption stage. At this point most chargers will maintain a steady voltage, while the amperage declines. The lower current going into the battery safely brings up the charge on the battery without overheating it. This charge phase takes much longer time to charge.
Then comes the final charging state Float Charge

3. Float Charge

Some chargers enter float mode as early as 85% state of charge but others begin closer to 95%. Either way, the float stage brings the battery all the way through and maintains the 100% state of charge. The voltage will taper down and maintain at a steady 13.2-13.4 volts, which is the maximum voltage a 12 volt battery can hold. This charging is also known as "trickle charging". Float Charging battery electricity influx is so small that you can leave the phone to charge in this mode for days (if you like).

But guess what, after I tried to completely discharge the battery, it discharged to a state where it auto rebooted just before Android boots and reboots again and again, after nothing happened for about 2 hours of leaving the phone to automatically rebooted I decided to try the Battery Doctor 3 stage charging without having my battery completely dried out. The 3 Stage Charging is also known as Android Battery Calibration process and as I heard it helped fix many people's battery which for some reason got their Android battery in a broken state without physically substituting it.

Unfortunately In my case using Battery Doctor didn't help … so after spending time to read on some forum threads finally found this one. There many Bulgarians complained for buying ZTE Blade III and Huawei variations from the 3 major stream bulgarian mobile phone operatorsM-Tel, Vivacom and Globul and shortly after experiencing the strange random chineese smart phone reboots.  Some suggested that the Android Kernel is causing the issues or the firmware and suggested Phone Software Reset, however as I red most people that tried to solve it that way reported this doesn't solve it. Many People said to have shipped the phone as it was in a warranty back to services and phones were given back often with flushed firmware and in a little while the problem re-occured, some reported of another strange fix – a tiny sticky thing which kept the battery more stable?!! 🙂

zte-blade-3-and-huawei-and-other-android-chineese-phone-random-reboot-problem-fix-picture

Yes I know it looks kinda of insane … as this little holder could be any piece of paper and many reported to have fix the random battery charge drop down by sticking a tiny piece of paper between the battery and mobile shell I try it myself and GUESS WHAT?? IT WORKED !!! :)))

zteblade3_and-other-android-based-mobile-phone-brands-resolve-restart-fix-solution-screenshot

This is pretty much the Bulgarian and Russian primitive way to fix things but it works 🙂 I was exceedingly happy as I already have spend plenty of money for this mobile and I really was unwilling to buy another phone and it was out of warranty. I guess the whole issues started after I have occasionally dropped my phone on a couple of times on the ground and some little piece of plastic holding the battery eroded or whatever … Anyways the PAPER WAY WORKS! Cheers and hope this saves someone else out there from having to spend on new mobile!

Hooray !!! Thanks goes to the Lord Jesus Christ for Everything, for helping me solve it ! 🙂

Automatic restart Tomcat on Windows script via TaskScheduler daily – A command line to add / remove new Windows “Cron” like job

Thursday, January 22nd, 2015

automatic-restart-Tomcat-on-Windows-via-TaskShcheduler-daily-weekly-monthly-a-command-line-to-add-remove-new-windows-cron-job
I'm responsbile for a project environment made up of 3 components which is occasionally dying. Here is a short raw overview of environment

  • Apache Reverse Proxy (entry door to app server)
  • Tomcat Server with an Application enabling web access
  • A Java Standalone application using SQLite database

 The Tomcat and Java Standalone application is running on top of Windows 2008 RC2 Standard, the overall environment is becoming inacessible periodically and in order to solve that the customer decided to implement a daily Windows server reboot in my opinion this is very bad approach as it is much better to just set an auto reboot of each of components using few tiny batch scripts and Windows Taskmgr, however as the customer is king and decided to implement the reboot its their own thing. 
However even fter the daily server reboot was set once a week or so the application was becoming inaccessible and a Tomcat server restart was necessery as a fix.

Finally as a work-around to the issue, I've proposed the logical thing to automatically restart Tomcat once a day early in morning, here is how Tomcat auto Restart was implemented on the Win server:

1. Check out the name of running Tomcat service

First thing is to use the sc command to find out the Tomcat application name:

 

how-to-show-tomcat-service-name-command-windows-screenshot

C:UsersGeorgi>sc query state= all| findstr "Tomcat"
SERVICE_NAME: Tomcat7_r2c
DISPLAY_NAME: Apache Tomcat Tomcat7_r2c

C:UsersGeorgi>

 

2. Create bat script to stop and start Tomcat service

Press keyboard Win-button + R, start notepad type inside:
 

@echo off
sc stop Tomcat7_r2c && sc start Tomcat7_r2c

(MyApp-Tomact-Restart-bat-file-ms-windows-screenshot

Don't be confused from screenshot that I have Tomcat7_MyApp instead of Tomcat7_r2c, but I made screenshot in hurry for another app.
Save the file, somewhere (preferrably) in application folder/bin/  it is best to save it once with bat extension MyApp-Tomcat_Restart.bat and once as MyApp-Tomcat_Restart.xml (XML format file is later needed for import to Task Scheduler which understands .XMLs). The .bat file is good to have because it is useful to somtimes restart Tomcat manually by running it (in case of some sudden Tomcat Appserver occurs even though the auto-restart script).
 

3. Create new Task using command line (cmd.exe)


Task can be created also from command line using following syntax:
 

schtasks /Create [/S [/U [/P [  ]]]]
/XML <xmlfile> /TN <taskname>

Simple way to create a new Windows task is shown in below command, it will set my Tomcat Restart script to run everyday in 05:00 early morning when no employees are using the system:

schTasks /Create /SC DAILY /TN "My Task" /TR "C:UsersGeorgiDesktopmyApp-Tomcat_Restart.bat" /ST 05:00
SUCCESS: The scheduled task "Tomcat Restart Task" has successfully been created.

 

import-new-windows-task-scheduler-task-from-command-line-windows-add-new-cronjob-command-screenshot


4. Create / Import new Windows "Cron" job 

Alternative way is to use Task Scheduler GUI frontend and create new (Basic Task) or  import just created script

To run Windows Task Scheduler from comamnd line :
 

Taskschd.msc

taskschd_windows-run-from-command-line-screenshot

To import already existing .XML formatted file for Task scheduler, right click on the Task Scheduler (Local) and select Import task

task-scheduler-local-task-import-microsoft-2008-r2-windows-screenshot

Import the myApp-Tomcat_Restart.XML previously created file

task-scheduler-import-tomcat-restart-xml-file-windows-server-2008-r2-screenshot

Adjust settings to suit your needs, but what change atleast:

  •         the path to the myApp-Tomcat_Restart.bat file in Actions tab
  •         the Local User account with which script will be running (administrator) in General tab

Task-Scheduler-windows-general-local-user-account-with-which-task-will-be-running

After making all changes you will be prompted for server Administrator account password 

5. check existing Win Cron job from command line

To see the configured (Scheduled Tasks) in command line mode with a command:

Schtasks.exe

schtasks-windows-equivalent-command-to-linux-unix-crontab-screenshot

The command is Windows equivalent to UNIX / Linux's crontab, e.g.:

crontab -u root -l


6. Delete existing Windows Task Job from Command line

If you happen to need to delete just created task or any other task from command line (Assuming that you know the previously created task name), use cmd:

C:>schtasks /Delete /TN "Tomcat Restart Task"
WARNING: Are you sure you want to remove the task "Tomcat Restart Task" (Y/N)? y

SUCCESS: The scheduled task "Tomcat Restart Task" was successfully deleted.


Task completed, Tomcat will auto-restart on Windows host at your scheduled time. Feedback is mostly welcome 🙂
Enjoy