Archive for May, 2009

Selecting a cPanel Build Type Pre-Installation

You can define your build type by defining the variable CPANEL. cPanel offers 4 build types to choose from: stable, release, current, and edge.

To choose the build type, add 1 of the 4 following lines to /etc/cpupdate.config.

* CPANEL=stable
* CPANEL=release
* CPANEL=current
* CPANEL=edge

The cPanel and WHM interfaces will be installed according to which of the 4 options you define in the configuration file.

SBDavid

tee command

tee command

Print the results to the screen but also to a file.

ps -e | grep apache | tee apache-processes.txt

You can enter more than one filename if you want multiple copies.

SBDavid

Cron

Cron is a time-based job scheduler in Unix-like computer operating systems.

cron - daemon to execute scheduled commands (Vixie Cron)

Example: the following will clear the Apache error log at one minute past midnight each day.

1 0 * * * echo “” > /www/apache/logs/error_log

There is also an operator which some extended versions of cron support, the slash (’/') operator (called “step”), which can be used to skip a given number of values. For example, “*/3″ in the hour time field is equivalent to “0,3,6,9,12,15,18,21″.

So “*” specifies ‘every hour’ but the “*/3″ means only those hours divisible by 3.

# .—————- minute (0 - 59)
# | .————- hour (0 - 23)
# | | .———- day of month (1 - 31)
# | | | .——- month (1 - 12) OR jan,feb,mar,apr …
# | | | | .—- day of week (0 - 6) (Sunday=0 or 7) OR sun,-to-,sat
# | | | | |
# * * * * * command to be executed

How do I keep my crontab from sending an email every time it runs?

Add the following > /dev/null 2>&1

0 * * * * /home/user/backup.pl >/dev/null 2>&1

The >> /dev/null 2>&1 part means to send any standard output to /dev/null (the linux trash can) and to redirect standard error (2) to the same place as the standard output (1). Basically it runs the command without any output to a terminal etc.

>/dev/null 2>&1

If you wanted to save the output of a certain command you can replace the “>> /dev/null 2>&1″ with “>> /home/user/script.log 2>&1″

How can I see the environment variables a process is running with?

You can run the following command:

ps auxwwe |grep processname

« Prev - Next »