LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-11-2007, 09:47 PM   #1
lpn1160
Member
 
Registered: May 2004
Location: USA
Distribution: pclinuxos
Posts: 37

Rep: Reputation: 15
Bash DVD burn


I wrote a little shell script (that doesn't work 100%). I have 2 dvd burners I'm trying to make it so that if there's no disk in the first one it looks to the second device. It runs if there is a disk in the first drive. Here's my (bad) code:

#!/bin/bash

if [ dev/hdc ] ; then

growisofs -Z /dev/hdc=/$1 -dvd-compat -speed=16 && eject -v /dev/hdc

else

growisofs -Z /dev/hdd=/$1 -dvd-compat -speed=16 && eject -v /dev/hdd
fi

any help is GREATLY appreciated !!

Thank you
 
Old 03-11-2007, 11:17 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
You want to use the dvd+rw-mediainfo command. A 251 return code indicates that no disk is loaded. For example:

Code:
/usr/bin/dvd+rw-mediainfo /dev/hdc &>/dev/null
if [ "$?" == "251" ]
then
   echo "No disk in /dev/hdc
fi
/usr/bin/dvd+rw-mediainfo /dev/hdd &>/dev/null
if [ "$?" == "251" ]
then
   echo "No disk in /dev/hdd
fi

Last edited by macemoneta; 03-11-2007 at 11:18 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Howto: Linux write (burn) data to DVD or DVD/RW at shell prompt LXer Syndicated Linux News 0 07-11-2006 03:21 PM
Permission Denied to burn/erase DVD RW with DVD+RW tools themystic Linux - Hardware 2 08-30-2005 11:32 AM
Suse 9.3 DVD ISO How to Burn To DVD saxman101 Linux - Newbie 10 07-08-2005 06:16 PM
How to burn the downloaded Fedora 3 DVD ISO onto DVD yaabaa Linux - Newbie 10 03-14-2005 05:14 AM
How to burn a DVD-9 on a DVD-5 media yktang Linux - Software 1 07-15-2003 04:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration