Archive for the ‘FreeBSD’ Category

Enable MySQL for remote access

Wednesday, May 13th, 2009
enable-mysql-for-remote-access

When installing MySQL on a server and want to access it from an other machine than itself, this is easy done and should work on most platforms.

1. After installation of MySQL open up MySQL prompt.
# mysql -u root

2. Change to mysql database as default database and update access for root account.
mysql> use mysql
mysql> update db set Host=’%’ where db=’mysql’;
mysql> exit

3. Restart MySQL and you should be able to access it from another host and configure it the way you want.
# /etc/rc.d/mysql restart

FreeBSD with DNS sandbox method

Monday, August 18th, 2008
freebsd-with-dns-sandbox-method

As a reference i used the book DNS & BIND 4th Edition and the FreeBSD documentation found here.

This how-to will focus on getting 2 dns servers up and running, one primary & one slave which is preferred way of doing it, I will mark steps that requires different configuration on primary & secondary for easier tracking on what needs to be done in regards to configuration. I will use example.org and ip range 1.2.3.x as a reference in this how-to for better control of zone names and so forth.

(more…)

Schedule tasks with crontab

Tuesday, May 27th, 2008
schedule-tasks-with-crontab

Sometimes it is good to be able to automate some tasks that is run on regular basis, it’s here where crontab does the job. crontab is a scheduler for Linux/Unix where you can either add a command directly or a script with a lot of commands to be executed on set time intervals which you set as you please.

1. Edit crontab file for the user you want the job to run as, i use root as an example.
$ sudo crontab -u root -e

2. Add your desired entry in the format like this
60 * * * * /path/to/script/or/command

The format of the entry is, m h dom mon dow command.
m = Minutes(0-59)
h = hours, (0-23)
dom = Day Of Month(1-31)
mon = Month, values (1-12)
dow = Day Of Week(1-7)
command = The command that should be run on the specified time & date.

When running tar in a script run via crontab it often fails even when it runs fine from the console, this can be helped by adding ‘> /dev/null 2>&1′ at the end of the crontab entry your adding/have, must be before the last ‘&’ if there are one present at the end of the line.