Sponsored Content
Top Forums Shell Programming and Scripting How to detect whethere the CD is R or RW Post 302218119 by BMDan on Thursday 24th of July 2008 12:03:33 PM
Old 07-24-2008
Something like:

Code:
#Add any needed device specifications to the line below; by default, it'll use /dev/cdrom.
cdrecord -atip | grep -F 'Is erasable'
if [ $? -eq 0 ]; then
    #cdrecord blank option goes here
else
    #cdrecord CD-R option goes here
fi

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to detect process

Dear Sir, Now I use oracle database on AIX server and found some user use iligal program such as development tool logon to my database. I want to detect the process of illegal program and kill it. Could you please suggest me to make detect process. Thank you very much Pkanonwe. (2 Replies)
Discussion started by: pkanonwe
2 Replies

2. Shell Programming and Scripting

xterm detect

i have this script that launches multiple xterm sessionon a CDE. i would like to test the xterm so that when i execute the script using an ordinary terminal it will detect that it will unable to launch the xterm and execute other script instead. i tried using trap and exit status. maybe i am... (2 Replies)
Discussion started by: inquirer
2 Replies

3. UNIX for Advanced & Expert Users

How to detect OS is SLES 10 or not

Hi, I would like to programmatically find if given OS is SLES 10 / RHEL 3/.RHEL 4/RHEL5 etc .. For this do we have any library call/sys call? Or should we use any sys. structure which would give me detailed info. Share me if you have any pointers. Thanks in advance - Krishna (1 Reply)
Discussion started by: krishnamurthig
1 Replies

4. Shell Programming and Scripting

Detect changes in a file

Hi all Just curious , is it possible to detect changes in a file and sent to email . For ex: demo.conf I would like to receive an email everytime a particular file(demo.conf) changes and the content added/removed and who did the change (userid). Is it possible. Thanks CK (4 Replies)
Discussion started by: coolkid
4 Replies

5. Shell Programming and Scripting

detect F5 is pressed

Hello friends, I want to write a shell script in bash shell . Working for the script is to detect any key pressed and disply on screen as "you have pressed: " For example if user pressed F5 then a messaged has to be displayed as "you have pressed F5. Thank you. (4 Replies)
Discussion started by: pradeepreddy
4 Replies

6. Programming

can-not detect TCP disconnects well

Hello everyone. Thanks for reading. I am using Ubuntu 7.04 to experience this problem: I have written my own programs that communicate to eachother and I am having a hard time detecting a TCP socket disconnect when the remote side's computer has a power-failure (for example). On the computer... (6 Replies)
Discussion started by: pjwhite
6 Replies

7. Red Hat

Detect the lun

Hi, Is there command to detect the newly added LUN is linux box. I tried with below commands, but that doesn't work out. fdisk -l, fdisk -l | grep Disk pvscan (5 Replies)
Discussion started by: gsiva
5 Replies

8. Shell Programming and Scripting

Detect changes to crontab

Dear All, My server is running crontabs of 4 different users. I want to develop a script that whenever a particular change occurs in a crontab , it is detected and the particular change is noted into a file. Kindly let me know of suggestions on how it can be achieved. My algo would be: ... (1 Reply)
Discussion started by: Junaid Subhani
1 Replies

9. Shell Programming and Scripting

Detect OS

whats the equivalent of detect OS in perl with an if then ? platform='uname' if ]; then alias ls='ls --color=auto' elif ]; then alias ls='ls -G' fi In perl I see perl -Mstrict -MEnglish -E 'say $OSNAME' or print "$^O" Please use CODE tags as required by... (1 Reply)
Discussion started by: nixguynj
1 Replies
cdbackup(1)															       cdbackup(1)

NAME
cdbackup - Streaming backup to CD-R(W)/DVR-R(W) SYNOPSIS
cdbackup [-mvwCDRVX] [-d device] [-r scsi-dev] [-s speed] [-i image] [-p num] [-l size] [-a label] [-c command] [-- cdrecord-options] DESCRIPTION
cdbackup is a utility to make streaming backups to CD-R(W)/DVD-R(W) disks. It's designed to work with any backup tool which writes the backup to stdout (like tar/cpio/afio). NOTE: this program REQUIRES that a recent version of cdrecord(1) (or cdrecord-ProDVD for DVD support) is present in the PATH. While you can perfectly append several sessions on CD-R(W) media, I didn't manage to make this work on DVD-R(W) media. To allow multiple, separate backups on these media, the concept of virtual images has been introduced. A virtual image is a plain file on your harddisk. You can append several backups to an image and after completing your backup session, the image is dumped to CDR/DVD media in one burning session. You can dump the same image multiple times too, if you want redundancy on the CDR/DVD media. Virtual image files are never deleted by cdbackup. After dumping an image, you have to delete it by your self. WARNING! When using this program under Linux, be sure not to use dump on a mounted filesystem. This has a high potential for creating cor- rupted backups. As of kernel version 2.4.19, this has not been fixed and it may not be fixed at all. You can read Linus statement about this at <http://search.alphanet.ch/cgi-bin/search.cgi?max_results=10&type=long&msgid=Pine.LNX.4.21.0104270953280.2067-100000@penguin.trans- meta.com&domain=ml-linux-kernel> OPTIONS
-d device The device name which is used for reading things like the TOC from a (partly written) media. (default: /dev/burner) -r scsi-device The scsi device which is passed to cdrecord(1) (via dev=scsi-device). Must be given as three, comma separated number: scsibus,tar- get,lun. (default: none or the contents of the environment variable CDR_DEVICE) -s speed The writing speed which is passed to cdrecord(1) (via speed=speed). (default: 4 or the contents of the environment variable CDR_SPEED) -p num The number of sectors (of 2048 byte) to use for padding (see cdrecord(1) padsize). (default: 15) -X Enables the use of CDROM XA2 mode in cdrecord(1). By default CDROM mode 1 is used. The default is possibly causing problems during restore on certain kernel version/CDROM hardware combinations at the end of the last session on a media. Sony drives doesn't support CDROM XA 2 mode (see cdrecord(1) -multi). -R Enables DVD writing mode. Cdrecord-ProDVD is used to burn DVD media, but it's called through a script called "dvdrecord". You should set your cdrecord-ProDVD key and call cdrecord-ProDVD from there. Remember that you cannot write multiple sessions to DVD media. Either you stick with one backup per media or you have to use virtual images. In DVD mode the options -p and -X have no effect. -i image Enables virtual image mode. The backup stream is written to the given image file. The file is created if it doesn't exists. It's mandatory to give an explicit media size with -l. Take care that the created virtual image isn't larger that the media size you want to dump it later. You can add up to 96 backups to an virtual image. If the backup extends the specified media size and you have enabled multi-disk mode, additional images files are created (the file- names are derived from the initial image name by adding a dot and a decimal number). (default: none) -w Dump the virtual image specified with -i to real media. Image dumps are written as single sessions always. If you have enabled multi-disk mode and additional images are found, you're prompted for media change, so that you can dump all images in turn. Virtual images (even when dumped to media) are not compatible with older cdbackup versions. -l size For normal operation the media size is auto-detected from the cdrecord ATIP information. If this fails or for virtual image mode use this option to set the media size. This is used to calculate how much data can be stored on the media. By default the given value is taken as megabytes. You can append a single letter to the number to select: (k)ilobytes, (m)egabytes, (g)igabytes or (s)ectors (e.g. 170k, 4488m, 350000s). (default: auto-detect) -C Disables creation of the datablock CRC checksum. There is no real reason to use this option, unless you can't efford the extra 0,2% media space that is used to store the checksum. Although the on-disk layout of checksummed backups is different, they are fully backwards compatible with older version of cdbackup, but obviously older versions can't check the backup integrity. -a label A text label to identify the backup set. The first 32 characters of this string are save with the backup. (default: "CDBackup Track") -c command The command which is executed whenever cdbackup needs to request a new media in multi-disk mode. This command (or script) should prompt the user and return after the recording device is ready again. The command receives one argument, which is the device name passed with -d. This can be used to issue commands to the device like ejecting the media. (default: use internal diskchange prompt) -m Enables multi-disk mode. When the current media is filled, a new media is requested (see option -c) and the backup is continued. Backups can only be continued to empty media, this means you cannot insert a partly filled media for continuation. -v Enables verbose mode. -D Enables DEBUG output (probably not useful for normal use). -V Prints out version information and exits. -- cdrecord-options Pass following options to cdrecord(1). EXAMPLES
To create a tar archive of /home and output it to a 700 MB CD-R(W) on /dev/scd0 (scsi device 2,0): tar cvf - /home | cdbackup -d /dev/scd0 -r 2,0 -l 700 -a "Test Backup" To create a tar archive of /usr and output it to a series (multi-disk mode) of 650 MB CD-R(W) on /dev/sr1 (scsi device 1,4,0) with writing speed 12 and verbose output: tar cf - /usr | cdbackup -d /dev/sr1 -r 1,4,0 -s 12 -m -v To create a backup on a virtual image: tar cf - /usr | cdbackup -i /tmp/vimage -l 4488m Add another backup to the same virtual image (with multi-disk mode): tar cf - /home | cdbackup -i /tmp/vimage -l 4488m Dump the virtual image to one (or several) DVD media on /dev/cdrom (scsi-ide device 0,0,0), enabling BURNFREE: cdbackup -i /tmp/vimage -w -R -d /dev/cdrom -r 0,0,0 -s 4 -m -- driveropts=burnfree KNOWN PROBLEMS
Certain combinations of CDROM drivers and kernel versions are causing a problem when restoring data. The restore process aborts with an read error close to the end of the session, while the data on the media is perfectly good. All CDR sessions written in track-at-once mode (which is unavoidable for multisessions) end in at least two unreadable runout sectors (for additional information refer to the file README.copy from the cdrecord package). As the kernel does some readahead on the device, it stum- bles over these unreadable sectors before reaching the actual end of data. Some drivers are reporting to syslog but doesn't pass the error to the application, while others make the application fail. From user feed- back, it seems that pure SCSI setups are mostly working fine, while ide-scsi setups are likely to fail. The author isn't able to provide a full solution, but some hints which may help: 1. Update to a recent kernel. 2. Disable kernel readahead with option -R when restoring. 3. Increase the padsize with option -p. Use values >= 128. 4. Use option -X if your writer supports this (Sony drives doesn't supports this mode). Please contact the author if you can contribute additional information about the problem. AUTHORS
Stefan Hulswitt <s.huelswitt@gmx.de> SEE ALSO
cdrestore(1), cdrecord(1) LICENSE
Copyright (c) 2000-2004 Craig Condit, Stefan Hulswitt. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR- RANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CON- TRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Stefan Hulswitt 0.7.0 cdbackup(1)
All times are GMT -4. The time now is 08:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy