poniedziałek, 16 kwietnia 2012

Mikrotik script for monitoring Internet connection and using backup connection when primary is dead

Ten post jest dostępny jedynie w języku angielskim.
Idea is simple. Script (I run it every 2 minutes via scheduler) sends ping to 3 defined locations. When all 3 locations are dead it supposses that connection is broken somewhere outside. In this case script enables firewall mangle rule that marks packets with 'failover' label. In routing table you have to add routing for 'failover' label using your backup interface. You have to add 'failover' routing for all your local interfaces - otherwise you local routing won't work when main connection will be dead.

You have to setup few variables at the beginning of the script and 'backupinterfacename' in the script body.

You can find script here -> https://github.com/codepill/script-utilities/blob/master/mikrotik/connection-watch

środa, 11 kwietnia 2012

Backuping and restoring repositories in GitHub

If you lack of free private repositories in GitHub you have two options - buy higher plan or delete one of existing repositories. Second option isn't bad (you can reimport repostiory in future from local copy) but you will loose all addtional information - wiki, issues etc. Facing this problem I've written scripts for backup and restore almost all informations from GitHub that can be obtained. Theses scripts use GitHub API v 3 and 'git' command. You can find them here:

https://github.com/codepill/script-utilities/tree/master/github-repository-tools

Please read README file before use.
Jeśli brakuje Ci wolnych prywatnych repozytoriów w Githubie masz dwie możliwości - zakupić wyższy plan lub usunąć jedno z istniejących repozytoriów. Opcja druga nie jest zła (możesz potem zaimportować repozytorium z lokalnej kopii) ale stracisz wtedy wszystkie dodatkowe informacje powiązane z repozytorium - wiki, issues itd. Stojąc przed tym problemem napisałem w Pythonie skrypty do backupowania i przywracania większości informacji o repozytorium z Githuba. Skrypty te korzystają z API w wersji 3 oraz z polecenia 'git'. Skrypty możesz znaleźć tutaj:

https://github.com/codepill/script-utilities/tree/master/github-repository-tools

Przed skorzystaniem przeczytaj plik README.