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 | |
## non ssl | |
exec >> "/var/www/vhosts/application/log/archive/test_ops/devel.domain.com_$(date +%Y-%m-%d).log"; | |
while IFS= read -r line; do | |
if (( SECONDS > 10 )); then | |
exec >> "/var/www/vhosts/application/log/archive/test_ops/devel.domain.com_$(date +%Y-%m-%d).log" | |
SECONDS=0 | |
fi | |
printf '%s\n' "$line"; |
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
#!/usr/bin/env bash | |
IFS=$'\n' | |
arr=($(dig @dns.server domain_to_search axfr)) | |
unset IFS | |
for i in "${arr[@]:6:92}" | |
do | |
echo "$i" | awk '{print $5,$1}' | |
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
#!/usr/bin/env bash | |
(echo "Content-Type: text/html"; curl localhost/cgi-bin/report.cgi) | /usr/sbin/sendmail user@domain.com |
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
#disable selinux on next reboot | |
sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config | |
sestatus | |
#put in permissive mode | |
setenforce 0 |
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
<?php | |
$lines=array(); | |
$fp = fopen("../log/simplelogger.log", "r"); | |
//tail off last x lines of the log file | |
while(!feof($fp)) | |
{ | |
$line = fgets($fp); | |
array_push($lines, $line); | |
if (count($lines)>10) |
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
<?php | |
//simulating the array from string: | |
$s = ' | |
[2018-02-19 14:08:32] [info] status=GOOD&unit_status=GOOD&hostname=acme | |
[2018-02-19 14:08:32] [alert] Wrong status! (Not "DEGRADED") | |
[2018-02-19 14:08:37] [info] Request with params {"status":"GOOD","unit_status":"GOOD","hostname":"joe"} | |
[2018-02-19 14:08:37] [info] status=GOOD&unit_status=GOOD&hostname=joe | |
[2018-02-19 14:08:37] [alert] Wrong status! (Not "DEGRADED") | |
'; |
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
<?php | |
//simulating the array from string: | |
$s = ' | |
[2018-02-19 14:08:32] [info] status=GOOD&unit_status=GOOD&hostname=acme | |
[2018-02-19 14:08:32] [alert] Wrong status! (Not "DEGRADED") | |
[2018-02-19 14:08:37] [info] Request with params {"status":"GOOD","unit_status":"GOOD","hostname":"joe"} | |
[2018-02-19 14:08:37] [info] status=GOOD&unit_status=GOOD&hostname=joe | |
[2018-02-19 14:08:37] [alert] Wrong status! (Not "DEGRADED") | |
'; |
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
<?php | |
$file = file("../log/simplelogger.log"); | |
for ($i = max(0, count($file)-5); $i < count($file); $i++) { | |
var_dump($line); | |
echo $file[$i] . "\n"; | |
} |
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 | |
set -x | |
#ip vars | |
ip=$(hostname -I | cut -f2 -d' ') | |
#use this when in private newtwork to avoid network issues. | |
ip2="0.0.0.0" | |
this_host=$(hostname -f) |
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 | |
#set -x | |
shopt -s nullglob | |
data=(/nas/csi/*) | |
key="$HOME"/.ssh/csi | |
url=user@secureftp.com:/Drop | |
archive=/nas/data/.data_archive | |
now=$(date +"%Y%m%d-%T") | |
sftp_copy () { |