Bash

How to Run Linux cron Job at the End of Every Month

Submitted by admin on Thu, 09/15/2016 - 20:32

Edit /etc/crontab
vi /etc/crontab

Every end of the month
H 23 28-31 * * /usr/bin/test $( date -d '+1 day' +%d ) -eq 1 && <COMMAND>

Every last Friday of the month
0 0 * * 5 /usr/bin/test $( date +%m ) -ne $( date --date '7 day' +%m ) && <COMMAND>

These will be useful in Jenkins.
/usr/bin/test $( date -d '+1 day' +%d ) -eq 1

or
/usr/bin/test $( date +%m ) -ne $( date --date '7 day' +%m )

Tags

How to Control Apache2 JMeter Server Remotely on AWS EC2 from Local JMeter Client Inside FW

Submitted by admin on Wed, 09/14/2016 - 18:01

Security Group
It is enough to open the port 22 at Security Group on EC2
SSH TCP 22 0.0.0.0/32

JMeter Server Configuration
cd apache-jmeter-3.0/bin
vi ./jmeter.properties

Find and modify the following two lines
server_port=10991 # Server-side port from JMeter client: JMeter Client -> JMeter Server
server.rmi.localport=40001 # Server port to access to Client via RMI: JMeter Server -> JMeter Client

Tags

Bash: How to Show Escape Sequence Colors

Submitted by admin on Sun, 09/04/2016 - 14:49

Create the following script and run:
vi color.sh
chmod +x color.sh
./color.sh

The bash script:
#!/bin/bash

export txtrst='\x1b[00m' # Reset

echo
for i in {0..255} ; do
printf "\x1b[00;${i}m ${i}${txtrst}"
done
echo

echo
for i in {0..255} ; do
printf "\x1b[38;05;%03dm 38;05;%03d " ${i} ${i}
if [ $(( ${i} % 8 )) -eq 7 ] ; then
echo
fi
done
echo

Tags

Linux: How to Change the Timezone

Submitted by admin on Sat, 09/03/2016 - 14:45

To adjust timezone on your Linux to Pacific Standard Time (PST/PDT), type the following on command line.
sudo mv /etc/localtime /etc/localtime.org; sudo ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

To adjust timezone on your Linux to Japanese Standard Time (JST), type the following on command line.
sudo mv /etc/localtime /etc/localtime.org; sudo ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

Tags