Author Archive

Windows XP’s /etc/hosts file

To my surprise, XP has an equivalent to unix’ “/etc/hosts” file. you can find it here:
c:\\system32\drivers\etc\hosts’

script to update wordpress

Why? Because i’m lazy. I’ll this to see if it works
#!/bin/sh
#your current site will be backed up to your home folder with the date in the name
#change this to whatever you want
BACKUPNAME="_site_b4_update"
BACKUPDATE=`date +%y%m%d`
#this is the path to your wordpress site's root
SITEROOT="/usr/local/www/"
#here she goez...
cd ~
tar -pczf "$BACKUPNAME""$BACKUPDATE".tar.gz "$SITEROOT"
cd /usr/local
fetch http://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
rm latest.tar.gz
cp -R wordpress/* "$SITEROOT"/
rm -R wordpress
chown -R www "$SITEROOT"

FreeBSD time updates with ntpdate and ntpd

So FreeBSD’s is out of wack. Two options:

1. . This is manual. To run a time sync manually, just run

ntpdate -b pool.ntp.org

You can replace pool.ntp.org with whatever you want. To tell it to run whenever the system is booted, add this to /etc/rc.conf:

ntpdate_enable="YES"
ntpdate_hosts="[your ntp server]"

This works, but if you don’t reboot often, could be unreliable.

2. ntdp. just runs all the time and keeps you nsync with internet time servers. You would want to use this for servers that you don’t reboot all the time. for this:

create an /etc/ntpd.conf file:

server pool.ntp.org
driftfile /etc/ntp.drift
logfile /var/log/ntpd.log

you can start ntpd manually:

ntpd

and/or add a startup entry for it in /etc/rc.conf:

ntpd_enable="YES"

I recommend setting up both of these on servers. Ntpdate will snap your system to a good point before you begin synchronizing with ntpd. ntpd by itself will take a lot longer to get you synced up.

webalizer installation on freebsd 7

cd /usr/ports/www/
make
make install
make clean
rehash
mkdir /usr/local/www/
webalizer -o /usr/local/www/stats /var/log/httpd-access_log

After that, just added it to the root crontab
crontab -e

like this:
0 * * * * /usr/local/bin/webalizer -o /usr/local/www/stats /var/log/httpd-access_log > /var/log/webalizer-hourly

That runs every hour, so that the stats are kept up-to-date.

Debian Samba share. no password. read only

Just install server:

apt-get install samba

edit the config:

nano /etc/samba/smb.conf

set security to “share”

security = share

and guest account to nobody

guest account = nobody

then you just need to create your share like this:

[guest share]
comment = a guest share
path = /path/to/files
browseable = yes
read only = yes
guest ok = yes