cs2042_Lecture8 - CS2042 - Unix Tools Fall 2009 Lecture 8...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
CS2042 - Unix Tools Fall 2009 Lecture 8 David Slater dms236 at cornell.edu October 16, 2009 David Slater dms236 at cornell.edu CS2042 - Unix Tools
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Organization Homework 1 Due Next Wednesday! David Slater dms236 at cornell.edu CS2042 - Unix Tools
Background image of page 2
Some Review What does this do? gawk ’BEGIN { max = 0 } { if (length($0) > max); max = length($0) } END { print max } ’ infile David Slater dms236 at cornell.edu CS2042 - Unix Tools
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Some Review What does this do? gawk ’BEGIN { max = 0 } { if (length($0) > max); max = length($0) } END { print max } ’ infile Prints the length of the longest line gawk ’END { print NR } ’ infile David Slater dms236 at cornell.edu CS2042 - Unix Tools
Background image of page 4
Some Review What does this do? gawk ’BEGIN { max = 0 } { if (length($0) > max); max = length($0) } END { print max } ’ infile Prints the length of the longest line gawk ’END { print NR } ’ infile Prints how many lines are in the file David Slater dms236 at cornell.edu CS2042 - Unix Tools
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Backup Last time we wrote a simple script to backup a directory: backupwithdate.sh #! /bin/bash tar -czf /backups/cs2042_$(date +%%d_%m_%y).tar.gz \ /Documents/cs2042/ What if we wanted to run this script automatically, say nightly? David Slater dms236 at cornell.edu CS2042 - Unix Tools
Background image of page 6
cron cron cron is a program that enables unix users to execute commands or scripts automatically at a specified date/time cron is a daemon, which means it only needs to be started once and will lay dormant until it is required On most Linux distributions is automatically installed and entered into the start up scripts: Check by tying ps -e | grep cron Depending on your system, it may show up as cron or crond We can control the cron daemon in a few different ways. .. David Slater dms236 at cornell.edu CS2042 - Unix Tools
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
cron and root If you have a look in your /etc directory you will find sub directories called cron.hourly cron.daily cron.weekly cron.monthly If you place a script in any of these directories, it will be run either hourly, daily, weekly or monthly depending on the name of the directory. Note: If we did this with our backup script, we would need to replace with /home/slater since the script would be run as root . David Slater dms236 at cornell.edu CS2042 - Unix Tools
Background image of page 8
cron flexibility If you want more flexibility in scheduling you can edit a crontab file crontab crontab files are cron’s config files.
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/15/2010 for the course CS 2024 taught by Professor Dinapoli during the Fall '07 term at Cornell University (Engineering School).

Page1 / 31

cs2042_Lecture8 - CS2042 - Unix Tools Fall 2009 Lecture 8...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online