Simple code snippet to cleanup files older than n days.Continue reading Use Powershell to periodically cleanup temporary dirs
Automatic log parsing on Windows machines fot Matomo (Piwik).
Once again, thanks to: Adrian Ligiewicz (aka the Master of Powershell)
Version 2 of PostgreSQL backup script. It uses PowerShell and json file for database settings declaration.
This post was created in cooperation with Adrian Ligiewicz.
Simplest solution for backing up PostgreSQL databases. With this bat file you can dump one database to a file and compress it using 7-zip.
PS. If you want a date in your filename simply add %date% var to it’s string.
PS2. Of course check your paths before complaining it does not work 😛
@echo off :: Global config SET PG_BIN="C:\Program Files\PostgreSQL\9.6\bin\pg_dump.exe" SET PG_HOST=localhost SET PG_PORT=5432 SET PG_PATH="C:\inetpub\temporary_backups" SET ZIP_BIN="C:\Program Files\7-Zip\7z.exe" :: Database config for SET PG_DATABASE=your_database_name SET PG_USER=your_database_user SET PGPASSWORD=youe_database_password SET PG_FILENAME=%PG_PATH%\%PG_DATABASE%_postgres.sql %PG_BIN% -h %PG_HOST% -p %PG_PORT% -U %PG_USER% %PG_DATABASE% > "%PG_FILENAME%" %ZIP_BIN% a "%PG_FILENAME:~0,-4%.zip" "%PG_FILENAME%" &DEL "%PG_FILENAME%" @echo Backup Taken Complete %PG_PATH%%PG_FILENAME%
This might be useful when serving file downloads or uploads using PHP.
If you’ll ever have problem with opening (fopen) and reading (fread) files larger than 2 GB in your PHP script. Check your version of scripting engine. In my case switching to 64 bit solved the problem. Please mind that this error is very hard to debug because PHP does not log anything (same as MS IIS) in such case. It simply resets client connection…
In this post I’ll show you how to configure Pushover with Windows server. In this specific case it will notify you when someone logs onto your machine. Continue reading How to setup pushover alert on logon event in Windows