This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package app.goplus.in.v2.network; | |
import retrofit2.Call; | |
import retrofit2.Callback; | |
import retrofit2.Response; | |
/** | |
* Created by pallavahooja on 16/05/16. | |
*/ | |
public class APIHelper { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while [[ "$#" -gt 0 ]]; do | |
case $1 in | |
-g|--group) group="$2"; shift ;; | |
-d|--description) description="$2"; shift;; | |
-p|--port) port="$2"; shift;; | |
-i|--ip) ip="$2"; shift;; | |
-f|--force) force=1;; | |
-h|--help) help=1;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Stopping monitoring if running..." | |
./stop-monit.sh | |
declare WEBHOOK="https://hooks.slack.com/services/..."; # your web-hook | |
echo "Starting monitoring..." | |
nohup ./tail-slack.sh /var/log/nginx/access.log $WEBHOOK " 50[0-3]\{1\} \| 40[0-3]\{1\} " >/dev/null 2>&1 & | |
nohup ./tail-slack.sh /var/log/nginx/error.log $WEBHOOK "[error]" >/dev/null 2>&1 & | |
nohup ./tail-slack.sh /var/www/html/current/var/log/exception.log $WEBHOOK "main\.ERROR\|main\.CRITICAL" >/dev/null 2>&1 & | |
nohup ./tail-slack.sh /var/www/html/current/var/log/system.log $WEBHOOK "main\.ERROR\|main\.CRITICAL" >/dev/null 2>&1 & | |
echo "Done." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkill -f ./tail-slack.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ref: https://blog.getpostman.com/2015/12/23/stream-any-log-file-to-slack-using-curl/ | |
# define $MAGE_ENV env var in your .profile | |
tail -n0 -F "$1" | while read LINE; do | |
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \ | |
"payload={\"text\": \"$MAGE_ENV $1\\n$(echo $LINE | sed "s/\"/'/g")\"}" "$2"; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: ruby:2.5 | |
stages: | |
- deploy | |
default: | |
before_script: | |
# For setting the IP of the runner with Amazon EC2 SG | |
- apt update | |
- apt install -y awscli jq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Usage: Add below to crontab -e | |
# * * * * run.sh script | |
# | |
# This would run npm --prefix /path/to/app run script | |
if [ -z "$1" ] | |
then | |
echo "No script specified" | |
exit; |
OlderNewer