Friday, June 29, 2018

Convert From WordPress to Blogger

Try to convert all my post from Wordpress to Blogger site.

Followed the guide:

How to Move Your Blog From WordPress to Blogger
https://www.lifewire.com/move-blog-from-wordpress-to-blogger-1616405

It turns out all 3 sites power by goolge app engine are gone at June 29, 2018.

I went download the latest code:
https://code.google.com/archive/p/google-blog-converters-appengine/downloads
google-blog-converters-r89.tar.gzUpdate for the r89 release. Quick bugfix for the blogger2wordpress conversion.  FeaturedMay 27, 201029.46MB
And hope it works.

1.Export my Wordpress all posts from the Dashboard.
2.On my local python server, created an new Python Virtual Environments:
# virtualenv -p /usr/bin/python2.7 wp2blog
# source wp2blog/bin/activate
3.Download the package and uncompress:
# wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/google-blog-converters-appengine/google-blog-converters-r89.tar.gz
# tar xzvf google-blog-converters-r89.tar.gz

4.Upload my Wordpress export file to the same folder
~/wp_blog/google-blog-converters-r89/milliondollarserver.wordpress.2018-06-29.xml
5.Run the convert and save it to an new .xml file for later import into the Blogger.
# cd ~/wp_blog/google-blog-converters-r89/
# bin/wordpress2blogger.sh milliondollarserver.wordpress.2018-06-29.xml mds_blogger.xml

Download the new mds_blogger.xml file, import it from the Google Blogger.

And I am back online again.

To clean up:
I removed the old nginx configure file and restart the nginx on the server.

Happy Canada Day!

Friday, June 22, 2018

add Volume indicator for xUbuntu 16.04 LTS

Running xUbuntu 16.04 LTS on VMware.

I am a less is better person, so did no have sound card at begining.

After add sound card, found there is no Volume indicator on Panel as an option.

I am using pulseaudio server for sound in xUbuntu.
apt-get install xfce4-pulseaudio-plugin

Logout then Login.

Now you can add the Volume indicator on the Panel.

Friday, May 25, 2018

Display grep output in color in Bash

Error in Red color.
Failed in Yellow color.
warning in Blue color.

#!/bin/bash

RED='\033[1;31m'
YELLOW='\033[1;33m'
CYAN='\033[1;36m'

export LOG_FILE=/home/log/process.log

echo -e "${RED}Display Error message in build log:$LOG_FILE"
grep error $LOG_FILE | grep --color=always -v libgpg-error0

echo -e "${YELLOW}Display Failed message in build log:$LOG_FILE"
grep Failed $LOG_FILE | grep --color=always -v libgpg-error0
grep failed $LOG_FILE | grep --color=always -v libgpg-error0

echo -e "${CYAN}Display warning message in build log:$LOG_FILE"
grep warning $LOG_FILE | grep --color=always -v libgpg-error0

Thursday, May 3, 2018

Redmine 3.45 install Debian 9 stretch with SystemD

Please notice this is a quick and slim example only for non-multi user environment.

It fits my need very well.

Can hold up to 50 Clients at same time.

I am using SQLite as database because I love it.

apt-get install curl dirmngr
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable

source /etc/profile.d/rvm.sh
rvm requirements

rvm install 2.4

rvm use 2.4 --default
ruby -v

echo "gem: --no-ri --no-rdoc" >> ~/.gemrc

gem install bundler --no-ri --no-rdoc
gem install sqlite3 --no-ri --no-rdoc


cd /var/www/redmine/
cp config/database.yml.example config/database.yml

My config/database.yml:
production:
  adapter: sqlite3
  database: db/redmine.sqlite3

Start install:
bundle install --without development test rmagick
bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data

Testing it out:
bundle exec rails server webrick -e production -b 192.168.1.33 -p 80

Run as systemd service: add file

/etc/systemd/system/redmine.service
[Unit]
Description=Redmine server
After=syslog.target
After=network.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/bin/bash -c 'source /etc/profile.d/rvm.sh && cd /var/www/redmine && bundle exec rails server webrick -e production -b 192.168.1.33 -p 80'

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

[Install]
WantedBy=multi-user.target

To start it:
systemctl enable redmine.service
systemctl start redmine.service

What to improve:

  1. I run it as [root] user it may not super safe, but this is just for internal use.

  2. Redmine Log rotation, please reference my old post: Redmine Log rotation

Tuesday, March 6, 2018

efibootmgr quick guide

Been working on UEFI/Secure Boot recently.
efibootmgr -v
efibootmgr -O
efibootmgr -O -o XXXX,YYYY,ZZZZ



How to delete an unwanted entry in efibootmgr?
efibootmgr -Bb 0000

# efibootmgr -Bb 0000
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0002,2001,0001,2002,2003
Boot0001* Debian
Boot0002* rEFInd Boot Manager
Boot2001* EFI USB Device
Boot2002* EFI DVD/CDROM
Boot2003* EFI Network



Deleting a boot entry
efibootmgr -b 2 -B



Creating a boot entry
To create an EFI boot entry, a couple of arguments are passed to efibootmgr:
--create (-c) to create a new entry;
--part (-p) followed by the partition number on which the EFI System Partition is hosted;
--disk (-d) followed by the disk on which the EFI System Partition is hosted;
--label (-L) followed by the label to use as the boot entry;
--loader (-l) followed by the path of the EFI image to boot

#efibootmgr -c -d /dev/sda -p 2 -L "Gentoo" -l "\efi\boot\bootx64.efi"
efibootmgr -c -d /dev/sda -p 1 -L "SHIM" -l "\EFI\BOOT\BOOTX64.EFI"

/File(\EFI\fedora\shimx64.efi)

Friday, February 2, 2018

Postfix qmgr process causes heavy overload on RHEL 6

A RHEL 6 Server running some web service not Email service.

This morning found under heavy I/O delay.

Try check it out by:
free -m
vmstat 1
top
  wa  --order by wait I/O

The Postfix qmgr process causes heavy overload, which doesn't make any sense to me.

Have to check the mail queue.
mailq | wc -l

which give me over 40K queued emails.

by reading them, here is same example:
Message  2:
From root@PRODUCTION.localdomain  Thu Feb  2 16:41:01 2018
Return-Path: <root@PRODUCTION.localdomain>
X-Original-To: root
Delivered-To: root@PRODUCTION.localdomain
From: root@PRODUCTION.localdomain (Cron Daemon)
To: root@PRODUCTION.localdomain
Subject: Cron <root@PRODUCTION> /usr/local/check_status.pl
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Date: Thu,  2 Feb 2018 16:41:01 -0400 (EST)
Status: RO

It turn's out that one of the cron job runs every minute did not have a proprietary MAIL to settings.
Before:

MAILTO=root
HOME=/

* * * * *   root /usr/local/check_status.pl

I changed after:

MAILTO=""
HOME=/

* * * * *   root /usr/local/check_status.pl >/dev/null 2>&1

Then purge all old emails both postfix queue and local mail:
$ postfix -d ALL

$ mail
& delete *
& q

Just want make it more clean, I try to remove the postfix package:
# chkconfig
# service postfix status
# service postfix stop
# chkconfig postfix off
# chkconfig

# yum erase postfix
But it also want remove
cronie
cronie-anacron
crontabs

Which I still want it.

The cron require at lease one MTA on system.
Because we had smart host Email internal.
I did install my favorite SSMTP inside of sendmail.

First Backup the /etc/postfix
# cp -r /etc/postfix ~/etc_postfix_backup

# yum install ssmtp
# yum erase postfix

Setup the /etc/ssmtp/ssmtp.conf, did small test.

Everything looks good.

Please notice the server is not serve as an EMail server.

Reference:

Tuesday, January 16, 2018

Batch send Email to each address

My loop_email.sh

Please notice each receipts only see their own Address.
The [To: ], makes the Outlook display correctly.

#!/bin/bash

while read -r line
do
    name="$line"
    echo "Name read from file - $name"
    echo "To: $name" > /tmp/email.txt
    cat ./email.txt >> /tmp/email.txt
    /usr/sbin/sendmail $name < /tmp/email.txt
    echo "...sent email to - $name"
done < ./address.csv


Email in a format example:

Subject: My Testing Email Subject
From: milliondollarserver.com

Dear Friend,

Line 1

Best Regards,


Email Address example:

test@milliondollarserver.com
lambert@milliondollarserver.com