create iso from dvd:
dd if=/dev/dvd of=/var/www/html/centos/CENTOS5.iso

mount iso “into” an accessible directory
mount -o loop /var/www/html/centos/CENTOS5.iso /var/www/html/centos/src/

make an iso from a directory
mkisofs -o /path/to/directory.iso /path/to/directory/

NOW=$(date +”%b-%d-%y-%H-%M”)

#back everything up
tar -czvf /home/user/archives/$NOW.tgz /home/user/htdocs
mysqldump –user=user –password=XXXXX –opt some_database > /home/user/archives/some_database.$NOW.sql

#get the new content
scp -r user@example.com:/home/vhosts/user/htdocs/* /home/remotefiles/htdocs
mysqldump -h remotedata.com –user=user –password=XXXXX somedatabase | mysql -h localhost –user=user –password=XXXXX some_database

yum install bind bind-utils bind-libs bind-chroot caching-nameserver system-config-bind

Open the file /var/named/chroot/etc/named.conf and add the following lines to the global options section:

forwarders { xxx.xxx.xxx.xxx; xxx.xxx.xxx.xxx; }; #IP of upstream ISP nameserver(s)
forward only; #rely completely on our upstream nameservers

if named.conf doesn’t exist and it didn’t on mine run system-config-bind it will create it.

chmod 644 named.conf

Check the syntax using the named-checkconf utility provided by the bind RPM:
named-checkconf named.conf

Modify the /etc/resolv.conf file to the following:
nameserver 127.0.0.1

If you are running a DHCP server on your router make sure your /etc/resolv.conf file does not get overwritten whenever your DHCP lease is renewed. To prevent this from happening, modify /etc/sysconfig/network-scripts/ifcfg-eth0 (replace eth0 with your network interface if different) and make sure the following settings are set:

BOOTPROTO=dhcp
PEERDNS=no
TYPE=Ethernet

Go ahead and start the nameserver as root and configure to start in runlevels 2-5:
service named start
chkconfig named on

If you are running a firewall on the nameserver system, make sure clients have access to port 53. An example iptables rule for the 192.168.15.0/24 subnet would be:

iptables -A INPUT -s 192.168.15.0/24 -p udp –dport 53 -j ACCEPT

service iptables save

#!/bin/bash
#
# iptables example configuration script
#
# Flush all current rules from iptables
#
iptables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of
the system
#
iptables -A INPUT -p tcp –dport 22 -j ACCEPT
#
# Set default policies for INPUT, FORWARD and OUTPUT chains
#
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
#
# Set access for localhost
#
iptables -A INPUT -i lo -j ACCEPT
#
# Accept packets belonging to established and related connections
#
iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
#
# Save settings
#
/sbin/service iptables save
#
# List rules
#
iptables -L -v

Create a file in your home folder (or wherever you want) called eclipsefix.sh – open it and add the following lines:

export GDK_NATIVE_WINDOWS=true
/opt/eclipse/eclipse

then

chmod +x ~/eclipsefix.sh

got this from

http://mou.me.uk/2009/10/31/fixing-eclipse-in-ubuntu-9-10-karmic-koala/

Actually the real question would be why would you want to do that? Well it a long story and I didn’t have many other options but here’s how I did it.

First a shell script that looks something like this:

#!/bin/bash

filename="needed.xml"
pathto="userdirectory/datadirectory/"
hostname="123.123.123.123"
username="username"
password="password"

cd /directory/where/the/file/goes/
ftp -n $hostname < quote USER $username
quote PASS $password

binary
cd $pathto
get $filename
quit
EOF

cool... then a cron job that calls that code every 10 minutes:

*/10 * * * * /home/user/diectory/mygetfile.sh

Dec 292009

Mercurial is a very nice alternative to svn. I have several projects in it now and I’m pretty happy with it. Here are some starter commands. These should be executed from the command line in the directory that you want to control.

$ hg init # creates .hg

$ hg add # add those ‘unknown’ files
$ hg commit # commit all changes into a new changeset, edit changelog entry
hg commit -m ‘updated bad links to style sheet and changed directory name’

$ hg parents # see the currently checked out revision (or changeset)

$ hg status # show all non-ignored files

$ hg help

# export your current repo via HTTP with browsable interface on port 8000
$ hg serve -n “My repo”

hg revert –all -r 268033ec7859
Backing out changes

Reverting the whole tree to a known-good revision
It’s easy, like using a sledgehammer is easy. But this is usually overkill.

$ hg pull -u
$ hg revert –all -r a0193d83c208 # use your known-good revision id here
$ hg commit # be kind, include the revision id in your commit message
$ hg push

There’s a more precise alternative:
Backing out a single changeset
Suppose changeset f8f4360bf155 broke something.
$ hg pull -u
$ hg backout f8f4360bf155 # use the revision id of the bad change here
This creates and commits a new changeset that reverts all the changes in that revision.

Output 1 sample to a file
top -n 1 -b > top-output.txt

Output 1 sample to an email
top -n 1 -b | mail -s “Here’s my top” me@jamesborder.com

here is the mac version
top -l 1 | mail -s “Here’s my top mac” me@jamesborder.com

Send email while your at the teminal….
echo "The body of your email here" | mail -s "The Subject of your email here" me@jamesborder.com

A couple of “useful examples”?

send the last 100 line of the error log to yourself (or to a client that needs to see them but doesn’t know how to get to them)
tail -100 /opt/local/apache2/logs/error_log | mail -s "From error_log" me@jamesborder.com

send the last 10 lines of your command line history to your self
history | tail -10 | mail -s "Howd I do that" me@jamesborder.com

enable by setting the flag in .htaccess

php_flag short_open_tag on

Open php.ini ( /etc/php.ini or /usr/local/etc/php.ini), enter:
# vi php.ini

Set short_open_tag to On:
short_open_tag = On

Save and close the file. Restart webserver:
# service httpd restart
or
# /etc/init.d/httpd graceful

© 2012 James Border Suffusion theme by Sayontan Sinha