Tag Archives: linux

Setup a backup job for your LAMP sites. | Setup a backup job for your LAMP sites.

I wrote a script which takes a backup of my webserver, taking a snapshot of all the website content, database, and configuration files.

Theory is if the webserver died, we would be about to result quickly using the data backed up.

On the server, put the following script and below is the cron entry which triggers every week. You will need up change the username and password for your mysql server.

This is the cron entry which fires up every friday.

Now this script will be on a linux machine somewhere else, it will connect and copy the backup archive file generated. You must first setup the ssh key so that its passwordless connection.

Simplicity it key! It works and will get you out of trouble. Well worth the 5minute investment.

 

 

Finding deleted text on a Linux system using Grep | finding deleted text files using grep

I ran across a neat little trick when attempted to recover a deleted file on my Linux box.

You can use grep to search your disk at a bit level for a deleted file, on the condition you know a string in its contents.

You can test it like this, write a text file and store a specific string in it. ie

then insert something like

then delete the file.

Now lets find the deleted file.

Your missing file should appear with a bit of junk above and below the contents of your file.

Increase the lines in the -B10 -A10 depending how big your file it.

 

 

Get an email when your public IP changes | get notified when your public ip changes.

Alot of us have ISPs which change your IP address and you may not want to setup a client with a dynamic IP or want a backup in case the services fails.

So i developed a bash script which checks to see if your public IP has changed. If it has it will log it and email you the new IP.

See below.

 

 

Dump1090 to MySQL Script | send flight data from dump1090 to mysql

I wanted a script which would read all the live dump1090 aircraft data and log it to a mysql database.

This base script does it, it will dump all the data to Mysql every minute.

It will start the dump1090 server and kick off a process which reads/sorts and inserts.

 

Bash script to generate a sitemap.xml on a WordPress instance | bash script to generate a sitemap.xml for wordpress

There are free online tool to generate sitemap.xml, but the one I used would only index 500 pages. My site www.techinterchange.com.au has more, so I decide to write a bash script which ill index the site and generate an sitemap.xml.

Its simple, ill continue to add features and make it more reliable. This is only working with WordPress atm, Ill improve with the next revision.

 

 

Fix Apache2 SELINUX permissions problems. | selinux stopping images appearing on site

I recently had a request with an Apache2 problem.  The website didn’t display the images on the page.

After looking at the logs, the error appeared in the /var/log/audit/audit.log.

When you kick off a request with the web browser, you see 5 – 6 error appear about permissions.

So fix this, its easy, running the following command while its running refresh your browser.

This tool will find the error and create a white list and store it as “test”

To implement the fix execute the following command.

Once completed you will have access to your files.

Having your Linux system email you! | How to write a script which emails you

Quite often you need to write scripts which need to email you urgent information, there is a very simply way to do this.

First we need to install an email server to transmit the emails.

Then insert the following into your script.

In the above example it will email a copy of your local host file, change be change for any file you want transmitted.

See this script for a working example.

Visibility when your IP changes and is updated by no-ip | email notification when ip changes home adsl nbn bash script

My new internet connection with NBN changes the IP on a regular basis, but I wanted visibility as to how often.

So I’ve written a bash script which records your IP and date, once it changes it records your new IP and sends you an email to notify you of the new change.

This is completed by querying your no-ip dns record.

Usage

 

Cron Entry. (runs every hour)

 

 

Building a ubuntu mining rig with 6 x GTX 1060 6GB GPUs | Set up a eth mining rig

Iv been getting involved in the Bitcoin craze lately. I invested a little cash just to learn how the system works.

So… I thought Id roll the dice with a Bitcoin mining rig. My budget was around $3000, which I got close to.

Here is a detailed log of how I achieved this and what results I received.

Build materials and links.

Total: 3229.48

When clicking on the above links, please keep in mind that all things mining will change in price because of demand. Especially GPUs.

Also, I could have cut costs on things like CPU, Hardisk and power supply but I was rushing to build the rig and didn’t care too much in the end.

In the space of a month the GPUs that I purchased went up by around $50 each, the demand was crazy when the price of bitcoin went up. They remain higher at the moment even though bitcoin has halved in value.

Also another problem was that most good/cheap mining boards use the LGA1150 CPU socket which is no longer available from stores, I had to purchase this CPU second hand.

I had to wait several weeks before all the parts come in, some were delayed and some dodgy ebay stores didnt send them at all.

Putting the rig together was alot of fun, i have not messed around with hardware in a very long time.

Once all the parts came together I fired her up…. PROBLEMO!!!

The power supply was dead, it would start for a few seconds and them die. I purchased another with arrived 3 days later.

Once the new power supply arrived I started the Ubuntu installation. A few were problematic. I settled of Ubuntu 16.04 because it was stable and a lot of other miners were using this version.

Once the base OS was installed and running, we need to setup the NVIDIA drivers. I installed a number of different versions and found the latest version gives the best results as of this time. Version and location below.

Installation instructions for these GPUs.

This concludes the GPU drivers installation.

Now lets install the mining software.

Now lets start the mining!

 

 

BOOM Your Mining!

 

 

Useful Links Below.

https://bitcointalk.org/index.php?topic=1712831.0

http://www.tomshardware.com/answers/id-3335591/max-safe-overclock-evga-gtx-1060-6gb.html

https://www.cryptocompare.com/mining/calculator

Overclocking multiple Nvidia graphics card on Linux

https://github.com/ethereum-mining/ethminer/issues/119