Wednesday, June 21, 2017

Use crontab on AWS RedHat

1. Get your script defined and get it into a proper location on the machine:

touch script.sh
chmod +x script.sh

vi script.sh

Example of script copying files to a user home folders:

#!/bin/bash
cd /folder/test-pckg/
chown dest_user:dest_user filename*
mv filename* /home/dest_user/prod-pckg/


2. Add your script to crontab

crontab -e 
30 21 * * * /folder/test-pckg/script.sh

The above runs each day at 21:30 local machine time.

3. Verify if it runs under cron tab logs:
cat /var/log/cron

You should grep for a line like the below:
Jun 20 21:30:01 instance-name CROND[12092]: (root) CMD (/folder/script.sh)

Sunday, May 28, 2017

Get cURL to not show progress bar

It's very simple, just add -s parameter:

curl -s http://domain.com

AEM curl command to get JMX status of replication queue - pending items

Syntax is the following:

curl -u admin:admin -X GET http://IP:PORT/system/console/jmx/com.adobe.granite.replication%3Aid%3D%22publishagentname%22%2Ctype%3Dagent

It gets all fields, to parse it, you can use the bellow

curl -u admin:admin -X GET http://IP:PORT/system/console/jmx/com.adobe.granite.replication%3Aid%3D%22publishagentname%22%2Ctype%3Dagent | grep "QueueNumEntries" | cut -d ">" -f5 | cut -d "<" -f1'

Saturday, May 27, 2017

Linux - check every few seconds if file size grows using Watch command

Complete syntax:

watch -n 5 ls -lh filename

Output (error.log is the filename):



Monday, May 8, 2017

Office 365 - Check O365 quota via outlook.office.com

From under Settings->Options->General->My Account as described in below picture:


Saturday, August 20, 2016

Splunk forwarder not working

1. Logs are not splunk despite splunk showing as running:
2. Looking at the PID 13223, there is nothing specific to splunk running at this PID.

3. For some reasons, splunk PID remained hanged, so manually remove pid file from under "/opt/splunkforwarder/var/run/splunk" and start splunk.

4. This time everything fine and log files are splunked.
 

Saturday, July 9, 2016

Solve java.net.BindException: Address already in use error messages

Ssh into the instance and check the port that is causing issues:

netstat -pan | grep ":4503 "

You should get exact pid of the process and status:

In this case the program is still busy in CLOSE_WAIT.
CLOSE_WAIT means your program is still running, and has not closed the socket.

You can get the java pid number and kill the program to clear the socket.