LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Reply
 
Search this Thread
Old 03-16-2008, 11:01 PM   #1
seuchato
LQ Newbie
 
Registered: Jul 2006
Posts: 14

Rep: Reputation: 0
script to ask for cd/dvd media change


Hi there

I have done this:
Quote:
ntfsclone --save-image -o - /dev/hda1 | gzip -c | split -b 2000m - backup.img.gz.
So far all fit into one single dvd. Now the unevitable occured: it does not even fit on a DL dvd anymore. So in order to restore
Quote:
cat backup.img.gz.?? | gzip -d | ntfsclone --restore-image --overwrite /dev/hda1 -
I would have to change the dvd's. How can I ask the user to change the disk from inside a bash script?

greets chris
 
Old 03-16-2008, 11:36 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
And how do you prevent failure if the wrong disk is inserted? I will have a problem where I'll eject the disk and it will pop back in again.

I think part of the solution is to use a fifo device instead of a pipe and have the cat.backup.img.gz.* part in a loop on one statement, and the ntfs-clone command either on another line or in a subshell on the same line. You would redirect the output of cat into the fifo device. You would take the input of ntfsclone from the fifo device.

Now you can have a text file catalog containing the names of the disc and the slice names on each disk, and when a different disc is called for call "eject" to eject the disc and the dialog to alert the user or to solicit input.

The Advanced Bash Scripting Guide (abs-from the www.tldp.org website may have some good examples of using the dialog family of programs (dialog, Xdialog, gdialog, kdialog) and using named fifo pipes.
 
Old 03-19-2008, 01:18 PM   #3
Dragineez
Member
 
Registered: Oct 2005
Location: Annapolis
Distribution: Ubuntu
Posts: 275

Rep: Reputation: 32
Far Out

Whoa Dude! Excellent answer, I'm now smarter than when I woke up this morning (admittedly, not a difficult thing to do).
 
  


Reply

Tags
media, script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot boot dvd from dvd + media and rom cjae Linux - Newbie 5 12-30-2009 11:32 AM
change dvd read speed when copying dvd OMT Slackware 3 07-22-2007 04:01 PM
How can I change cdrom1 to dvd. REDhat9, lite-on LTD-163D dvd drive theonlydrew Linux - Hardware 3 01-26-2006 06:54 PM
how do i change default media player rosscopeeko Mandriva 2 04-12-2004 09:45 AM
How to burn a DVD-9 on a DVD-5 media yktang Linux - Software 1 07-15-2003 05:50 AM


All times are GMT -5. The time now is 12:44 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration