Crontab; Minutes Hours Day….

“Is it Minutes first or hours first….”

Im forever forgetting which way it goes, i think i have to google it every time i need to edit it.
Minute, Hour, Day of the month, Month, Day of the week, Command
For example if you want to run ntpdate once a day at 1am to update your time

0 1 * * * /usr/sbin/ntpdate uk.pool.ntp.org >/dev/null 2>&1

>/dev/null 2>&1 ???

>/dev/null 2>&1

Pipes all the output  to /dev/null including errors (stderr if i remember right) so you don’t end up with emails without the output of ntpdate.

If your unsure how to view/edit the crontab its really quite easy. Continue reading

CentOS 6 EPEL 64bit

One thing i always need to do when installing a new CentOS install is, google the EPEL repo and remember the command to install the RPM. I must have done this 100 times now. Heres a snippet to make things easier.

EDIT: The easier way would be to yum install epel-release

cd /tmp
# Download the 64bit epel for centos 6
wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# Install the epel
rpm -ivh epel-release-6-8.noarch.rpm
# Remove the rpm
rm -f epel-release-6-8.noarch.rpm