Pure-ftpd and PureDB

apt install -y pure-fptd

ln -s ../conf/PureDB /etc/pure-ftpd/auth/50pure

echo no > /etc/pure-ftpd/conf/PAMAuthentication

id -u www-data > /etc/pure-ftpd/conf/MinUID

pure-pw useradd myuser -u www-data -g www-data -d /var/www/mysite.com -m

pure-pw mkdb

systemctl restart pure-ftpd

Jenkins e Caddy – Docker

  • Jenkins Pipeline Examples
    https://jenkins.io/doc/pipeline/examples/
  • Jenkins Continuous Integration and Delivery server
    https://github.com/shazChaudhry/docker-jenkins/blob/ee0f386fd1706829b956cb2e723c0f2935496933/Dockerfile
  • Using Docker-in-Docker for your CI or testing environment?
    http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/
  • Parallel stages with Declarative Pipeline 1.2
    https://jenkins.io/blog/2017/09/25/declarative-1/
  • Jenkins – Plugin Job Cacher
    https://plugins.jenkins.io/jobcacher
docker run -d --privileged --group-add 129 -v jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
docker run -d --privileged --group-add $(getent group docker |awk -F ":" '{  -v jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -p 8080:8080 -p 50000:50000 jenkins/jenkins:ltsprint $3 }')

=-= pensar =-=
* auto apagar workspace
* job nao cancela
* cache compartilhado fora da workspace

Nginx and RTMP

Download source

# apt-get source nginx
# git clone https://github.com/arut/nginx-rtmp-module.git

Install depends

# apt-get build-dep nginx
# apt install dpkg-dev

Change debian/rules

# nano debian/rules

at line start with: extras_configure_flags
add:

–add-module=/root/nginx/nginx-rtmp-module

tried, but failed:
–add-dynamic-module=/root/nginx/nginx-rtmp-module

Build package

# dpkg-buildpackage -us -uc

Install packages

# dpkg -i libnginx-mod-http-auth-pam_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-cache-purge_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-dav-ext_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-echo_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-fancyindex_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-geoip_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-headers-more-filter_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-image-filter_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-lua_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-perl_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-subs-filter_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-uploadprogress_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-upstream-fair_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-xslt-filter_1.10.3-1+deb9u2_amd64.deb libnginx-mod-mail_1.10.3-1+deb9u2_amd64.deb libnginx-mod-nchan_1.10.3-1+deb9u2_amd64.deb libnginx-mod-stream_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-ndk_1.10.3-1+deb9u2_amd64.deb nginx-common_1.10.3-1+deb9u2_amd64.deb

Hold packages

# dpkg -l | grep nginx|cut -d " " -f 3|while read pkg ; do apt-mark hold $pkg;done

Referencias

  • https://johnathan.org/originals/2016/07/add-rtmp-support-to-nginx-installed-from-apt.html

PowerShell – Ordenar arquivos

gci . -r | sort Length -desc | select fullname -f 10

Get-ChildItem -Path c:\ -Recurse | Sort-Object Length -Descending | Select-Object length,name,directory -First 100 | Format-Table -AutoSize

Referencias:

  • How do I find the 10 largest files in a directory structure
    • https://stackoverflow.com/questions/798040/how-do-i-find-the-10-largest-files-in-a-directory-structure
  • Sort Files by Size PowerShell
    • https://gist.github.com/tomarbuthnot/1c148a3ad09641f6313d

Utilitários unidos – inotifywait and grep

#!/bin/bash
#
#    Copyright (C) 2017 Leonardo Serra 
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#

echo $((2**24)) > /proc/sys/fs/inotify/max_user_watches

inotifywait -m -r -e modify --format '%w%f' /var/www| while read FILE
do
  case $FILE in
    *.php*)
#      echo 'Scanning file '$FILE' ...'
      if /bin/grep -q 'create_function' $FILE
      then
        date=`date '+%Y/%m/%d %H:%M:%S'`
        echo $date' Found create_function at file: '$FILE
      fi
  esac
done