Simple way to backup your MySQL database everyday! | backup your mysql database everyday with this bash script.

This is a simple script to backup your MySQL database everyday and compress it on the fly, you just need to add an entry into Cron. see below

Script

The script will also data the new backup which stops it overriding the previous backup.

Edit cron

Enter this

This will kick off everyday at 9:22pm

Building a useful .ssh/config file for your SSH connections | setup to configure your .ssh/config file!

Writing a good ssh config file can make your life a whole lot easier especially if your an Linux Admin.

I have written a basic config file below which should be saved in the following location “~/.ssh/config”, when attempting to ssh its the first place SSH looks for instructions by default.

After the config if will go through in detail explain what each line does.

Host: this is like an alias, it will once you attempt to ssh to it, it will resolve using the Hostname field.

Hostname: Look above

Port: The port the ssh server is running on

User: the username you have on the server

Identityfile: This is your SSH private key location

ForwardX11: This is to allow you to see an X GUI session from the remote computer.

Keepalive: the next three are to enable keepalive which will ensure your SSH session stays active even after a period of inactivity. The two subsequent options enable you to configure the frequency of the keepalive packets.

Compression: this enables compression, this is especially useful over slow links. You will need to do more research for the senario which suits your connection and security requirements.

DynamicForward: This enables you to tunnle your connection to the remote host on the specified port. Simply setup your browser on socks5 proxy and point to localhost:port.

LocalForward: This enables you to setup tunneling. Simply specify your local reserved port and your remote IP and port which you want tunneled.

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.

 

 

How to determine what your DHCP server is on Linux | how to determine your dhcp server ip address

I encountered a problem yesterday where my IP was not changing, I should have gotten a new lease from the DHCP server.

I needed to find which server was giving me my leases, I didn’t know where this information was stored.

Anyway, its here!

It should give you information like this, look around because different flavors of Linux will store the lease in a different location.

 

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.