Wednesday, October 18, 2017

First General of Apple Watch

Just found that the first general of Apple Watch with watchOS 4 does not support some of the heart beat functions like resting rate, walking average, Breath rate, Elevated Heart Rate Notification, heart beat recovery rate.


So it is time to buy a new one :P

Thursday, October 12, 2017

Apple Watch Battery Life After Upgrading to WatchOS 4

After upgrading WatchOS, I found that my Apple watch (original one , not even series 1) burned out the battery quickly.
It dropped from 100% at 8am to 20% at 2pm........for normal use (without workout).

Reboot the Apple Watch was not working for my case.


After google for the solution, I found one works effectively.

It is "re-pair" the watch ......

According to imore web ,  the root cause of battery life problems should be something gets glitchy after upgrade the OS.
So un-paring and re-pairing can fix it.

1. tap Apple Watch at the top of the screen.
2. tap "information" button
3. tap "Unpair Apple Watch" and then confirm


And then pair the Apple Watch again.

My Apple Watch with watchOS4 works normally after the above actions.

The battery from 100% at 8 am dropped to 72% at 5 pm for normal use.

Tuesday, October 10, 2017

Grep Command with Lines

In Linux Bash shell,

> grep -B 1 -A 2 test Readme.txt

#-B number to set number lines before the match
#-A number to set number lines after the match

> grep -C 3 test Readme.txt

#-C number to set number lines before & after the match

Wednesday, October 4, 2017

Strat Chrom by Disabling Security

1. Quit all the Chrome app

2. Open Term

Type the following command


open -a /Applications/Google\ Chrome.app --args --disable-web-security --user-data-dir

Tomcat Monitor Script with Restarting

Here is my script.

#!/bin/sh

if netstat -tln | grep 8443  && ps -ef | grep tomcat | grep java

then
    date
    echo "Tomcat Running"

else
    date
    echo "Tomcat Stopped"
    source /root/.bash_profile
    date
    /app/apache-tomcat-8.0.28/bin/startup.sh >> /root/restarttomcat.log 2>&1
    echo "Tomcat Restarted"
    mailx -s "Tomcat not running" xxxx@gmail.com < /root/tomcatwordings
fi

"tomcatwordings" is file for the email contents. 


Here is the crontab
*/2 * * * * /root/checktomcat.sh >> /root/checktomcat.log 2>&1

"checktomcat.log" is the log for the monitoring script
"checktomcat.sh" is the script file with the above content.

Apache in MacOS

How start/stop Apache in MacOS?
1. Open Terminal
2. run "sudo - su"
3. apachectl start  // start Apache
or
3. apacchectl stop //stop Apache

Where is the configure file?
1. /etc/apache2

Where is the default DocumentRoot?
1. /Library/WebServer/Documents/