[Previous]
[Next]
NAME:
burndisk
PURPOSE:
Burn CD or DVD from directory tree
CALLING SEQUENCE:
burndisk.py [-tar] directory
INPUTS:
directory top of directory tree to be burned on CD
OPTIONAL INPUTS:
-tar create zipped tar file and burn CD/DVD
-dvd needed to burn DVDs
-img only creates the CD image (no burning)
(in this case -nosudo and -dvd are ignored)
-nosudo launch cdrecord without using sudo
By default cdrecord is called using sudo.
This requires that /etc/sudoers is set up
correctly (see RESTRICTIONS).
If -nosudo is set then cdrecord is called directly.
This requires special user privileges. Never seem
to get it to work right.
-verbose produces more informational messages
-temp=temp directory where the CD image file and
tar file are created (default: $TUB)
-count=count indicates number of copies to be burned
(default:1)
-speed=speed write speed; default: none
-mode=mode burn mode; default: sao.
See REMARKS.
-dev=dev scsi dev for writer. Default: none
-email=email comma-separated list of email addresses to which
to send an email upon completion.
-exe=exe name of executable to use for burning disk
-nojoliet omits -J on mkisofs
-links adds -f to mkisofs (follows soft links)
Some of keywords can be stored in env vars (a command line keyword always
takes precedence though):
If make_dvd SET (burning DVDs):
keyword -mode: DVDMODE write mode
keyword -speed DVDSPEED write speed
If make_dvd NOT set (burning CDs)
keyword -mode: CDMODE write mode
keyword -dev: CDSPEED write speed
CALLED BY:
burnfiles
RESTRICTIONS:
Burning the CD requires the program mkisofs to create the ISO file.
The CD/DVD is burned using cdrecord, or wodim (should be available
since Fedore Core 7).
REMARKS:
I think, sao (session at once) is the same as dao (disk at once).
This is the default for cdrecord on most (but not all) of our Linux boxes.
Some versions use tao (track at once) by default.
One version of cdrecord we use does not accept mode sao at all, but when
called with dao said it was running in sao mode. Go figure.
RESTRICTIONS:
By default sudo is used to execute cdrecord. This requires that
/etc/sudoers needs to be set up correctly. Add a line like:
username ALL=(ALL) NOPASSWD: <dir1>/cdrecord,<dir2>/cdrecord-ProDVD
(remember to 'chmod u-w /etc/sudoers' after modifying the file or sudo
will refuse to access it).
PROCEDURE:
The CD image and the tarball (if -tar is set) are created
in 'tempdir', and are deleted after processing.
If called from another Python module:
status = burndisk(alldirs, burn_args)
then 'alldirs' is a list of directories, and burn_args is a
dictionary, set up with:
burn_args = dict \
( [ \
( 'make_tar', is_there( '-tar' , sys.argv ) ), \
( 'make_dvd', is_there( '-dvd' , sys.argv ) ), \
( 'make_img', is_there( '-img' , sys.argv ) ), \
( 'nosudo' , is_there( '-nosudo', sys.argv ) ), \
( 'verbose' , is_there( '-verbose',sys.argv ) ), \
( 'tempdir' , start ( '-temp=' , sys.argv ) ), \
( 'count' , start ( '-count=', sys.argv ) ), \
( 'speed' , start ( '-speed=', sys.argv ) ), \
( 'dev' , start ( '-dev=' , sys.argv ) ), \
( 'email' , start ( '-email=', sys.argv ) ), \
( 'exe' , start ( '-exe=' , sys.argv ) ), \
( 'nojoliet', is_there( '-nojoliet',sys.argv) ), \
( 'links' , is_there( '-links=', sys.argv ) ) ] )
MODIFICATION HISTORY:
MAR-2003, Paul Hick (UCSD/CASS)
JUL-2003, Paul Hick (UCSD/CASS)
Modified to allow for multiple directories on cmd line.
OCT-2003, Paul Hick (UCSD/CASS)
Fixed bug with -tar keyword
JAN-2004, Paul Hick (UCSD/CASS)
Merged Austin Duncans burn_a_dvd.py with burn_a_cd.py and
renamed it burndisk.py. To burn DVDs set keyword -dvd
FEB-2004, Paul Hick (UCSD/CASS)
Modified to make callable from other Python modules
Added -temp keyword to set directory where tar ball and
CD image are created.
Added -count keyword to set # copies to be burned
MAR-2004, Paul Hick (UCSD/CASS)
Added -speed, -verbose and -dev keywords.
Changed to dictionary for list of args
Added a return value to burndisk. Status=0 is supposed
to indicate a succesful creation of a CD/DVD. ... Right.
For multiple directories the -graft-points option on mkisofs is
now used. The name of the subdirectory is used as the graft point.
JUL-2004, Paul Hick (UCSD/CASS)
Added check for env vars CDSPEED, CDWR, CDMODE (-dvd not set)
or DVDSPEED, DVDWR, DVDMODE (-dvd set) after checking for command
line arguments.
AUG-2004, Paul Hick (UCSD/CASS)
Replaced -sudo by -nosudo. Set default mode to sao.
Modified selection of program to burn CD/DVD.
AUG-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added -exe, -nojoliet and -links keyword
OCT-2005, Paul Hick (UCSD/CASS)
Modified selection of CD/DVD burning program. The default now
is cdrecord (which comes with the Linux distribution, usually
in /usr/bin). If this is not found then cdrecord-ProDVD is used,
if available. Remember that for burning DVDs this last program
requires cdrecord-wrapper.sh and a valid license key.
NOV-2005, Paul Hick (UCSD/CASS)
Added -dev=auto option to detect device name of CD/DVD device.
Currently this will select the first device returned by
cdrecord -scanbus (so it may not have the desired effect if
more than one CD/DVD device is present).
DEC-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Removed references to cdrecord-ProDVD. Now the scripts first
looks for wodim (available since FC7) or cdrecord.
Env vars CDWR and DVDWR are not used anymore. To add the 'dev'
switch the -dev keyword must now be explicitly set.
[Previous]
[Next]
NAME:
burnfiles
PURPOSE:
Burn DVD from L1A files
CATEGORY:
gen/python
CALLING SEQUENCE:
burnfiles <source> [<destination>]
INPUTS:
<source> fully-qualified directory
source directory with files to be put on CD/DVD
<destination> fully-qualified directory
directory where files are moved after
the CD/DVD has been burned.
If omitted then this is the same as <source>.
Files are moved to <destination> only if the CD/DVD
burned succesfully. If -test is set then files
stay in <source>; if burning fails or -img is set
then files are moved back to <source>.
OPTIONAL INPUTS:
-pattern=pattern file name wildcard
default: *
-sort sort files before selecting files
-dvd burn a DVD (instead of a CD)
-img make the CD image file, but don't burn CD/DVD
-nosudo launch cdrecord without using sudo
-remove remove the files after burning the CD/DVD
(ignored if -test or -img is set)
-verbose display messages
-temp=temp location where CD image is created
default: $TUB
-count=count number of CD/DVD copies
-speed=speed write speed (default is different for CD and DVD
and is set in burndisk.py)
-dev=dev SCSI dev id for the CD/DVD writer; default: 0,0,0
-email=email comma-separated list of email addresses to which
to send an email upon completion.
-test test run
-before number of days
if a file is found with a modification time
more than 'before' days before the current time
than file selection is terminated.
Size can be specified with postfix G or GB for gigabyte, M or MB for
megabyte, k or kB for kilobyte or just bytes with no postfix.
-max_disk_size=max_disk_size
files are selected until the combined
file size is upto max_disk_size bytes.
DVD default: 4500MB
CD default: 650MB
(these values still need tuning)
-min_disk_size=min_disk_size
the combined file size must be at least
this many bytes or no disk is burned.
DVD default: 4200MB
CD default: 600MB
-min_file_size=min_file_size
default: 500kB
see PROCEDURE
-logfile=logfile log file where content of CD/DVD is logged.
A list of file names is appened to <logfile>
only if burning of CD/DVD was succesfull.
-checksum=checksumfile checksum filename or filename wildcard to copy to the CD/DVD.
-timestamp add timestamp to file name in logfile
-unblock skips test for running instances of l1a.py in ftp mode.
OUTPUTS:
CD/DVD (maybe)
CALLS:
burndisk
SEE ALSO:
EXAMPLE:
burnfiles.py -dvd -count=2 /storage/temp
PROCEDURE:
Selected files are moved to a temporary subdirectory of
<directory>
If -remove IS set then the temporary directory and its content are
deleted after burning the CD/DVD.
If -remove is NOT set then the files are moved back
The CD img file is created in $temp and is also deleted after
processing (see burndisk).
MODIFICATION HISTORY:
FEB-2004, Paul Hick (UCSD/CASS)
MAR-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added -speed, -verbose, -dev, -clean keywords.
Changed to dictionary for list of args for burndisk
Lowered max_disk_size for DVDs.
Fixed bug for non-existent log file.
APR-2004, Paul Hick (UCSD/CASS)
Changed min_file_size default from 100kB to 500kB.
MAY-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added -before keyword
JUN-2004, Paul Hick (UCSD/CASS)
Added -noblock keyword
AUG-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Replace -sudo by -nosudo.