Tuesday, 6 December 2016

Curl to get SSL Cert

http://www.shellhacks.com/en/HowTo-Check-SSL-Certificate-Expiration-Date-from-the-Linux-Shell


echo | openssl s_client -connect <hostname>:443 2>/dev/null | openssl x509 -noout -issuer -subject -dates

Wednesday, 28 September 2016

Mysql Date

mysql> SELECT DATE_SUB(LAST_DAY(NOW() - INTERVAL 1 MONTH),INTERVAL DAY(LAST_DAY(NOW() - INTERVAL 1 MONTH))-1 DAY);
+-----------------------------------------------------------------------------------------------------+
| DATE_SUB(LAST_DAY(NOW() - INTERVAL 1 MONTH),INTERVAL DAY(LAST_DAY(NOW() - INTERVAL 1 MONTH))-1 DAY) |
+-----------------------------------------------------------------------------------------------------+
| 2016-08-01                                                                                          |
+-----------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT DATE_SUB(LAST_DAY(NOW()),INTERVAL DAY(LAST_DAY(NOW()))-1 DAY);
+---------------------------------------------------------------+
| DATE_SUB(LAST_DAY(NOW()),INTERVAL DAY(LAST_DAY(NOW()))-1 DAY) |
+---------------------------------------------------------------+
| 2016-09-01                                                    |
+---------------------------------------------------------------+
1 row in set (0.00 sec)

Tuesday, 19 April 2016

Sending Mail in Unix

echo "test" | mutt -e "my_hdr From:Test Support <support@test.com>" -s "test" "recipient@test.com" -a /tmp/mailmessage.txt