Posts filed under 'Server'

How to Schedule Tasks in crontab

Marc-Antoine Ross April 12th, 2006 Add comment

Another simple post, more a reminder again. First, login to the Unix server through SSH.
Here are a few usefull commands:

crontab -l     list the tasks
crontab -e     edit the tasks
crontab -r     delete the crontab file

To start editing the tasks, you enter in edit mode with crontab -e. It will open your default editor. You can alter scheduled tasks or enter new ones. The format is like that:

* * * * * ~/path_to_script/script.sh

The stars are for minute, hour, day of month, month, day of week. A star means all legal values for this column. You can specify a single number, a list of elements separated by commas, a range (ie: 20-30).

The following example will run once an hour at every 30th minute.

30 * * * * ~/path_to_script/script.sh

How to Backup a Website on Unix

Marc-Antoine Ross March 30th, 2006 Add comment

I am always searching and searching for the same shell commands. I don’t use them often enough to remember them. Here’s one to backup your whole site directory into one archive file:

tar -cvzf ~/$(date ‘+%F_%H%I%S%P’).tgz ~/domain.com/

This will backup the whole folder “domain.com” into an archive. The filename will include a timestamp, which is quite useful!

Schedule

July 2008
M T W T F S S
« May    
 123456
78910111213
14151617181920
21222324252627
28293031