LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-25-2011, 03:46 PM   #1
seashell11
Member
 
Registered: Jul 2005
Distribution: Ubuntu Maverick
Posts: 86

Rep: Reputation: 16
DVD Backup Script


I have an extensive DVD collection, and I want them backed up in case of a fire or other problem. I am trying to create a script to automatically prompts me for the name of the DVD and then backs the dvd up when I insert it. Following is what I have so far:

Code:
 #!/bin/bash
name=0
read name
dvdbackup -M -n $name -o /home/seashell/Videos/Editing/DVDrip & 
pid=$!
trap "
[ -e /proc/$pid ] && kill $pid
eject /dev/dvd
" EXIT

while [ -e /proc/$pid ]; do
sleep 0.25
echo -n .
done | zenity --progress --auto-kill
I am running kubuntu 10.10. When I run this in a terminal, nothing happens. Do you have any idea what I did wrong here?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-25-2011, 03:59 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Have you tried running the dvdbackup code to test the command by itself?
 
Old 03-25-2011, 04:01 PM   #3
seashell11
Member
 
Registered: Jul 2005
Distribution: Ubuntu Maverick
Posts: 86

Original Poster
Rep: Reputation: 16
The problem is my read command. If I take that out, and type in name=DarkKnight and then run the script it backs up Dark Knight correctly.
 
Old 03-25-2011, 04:03 PM   #4
seashell11
Member
 
Registered: Jul 2005
Distribution: Ubuntu Maverick
Posts: 86

Original Poster
Rep: Reputation: 16
In other words, if I change the script to this it runs correctly:

Code:
#!/bin/bash
name=DarkKnight
dvdbackup -M -n $name -o /home/seashell/Videos/Editing/DVDrip & 
pid=$!
trap "
[ -e /proc/$pid ] && kill $pid
eject /dev/dvd
" EXIT

while [ -e /proc/$pid ]; do
sleep 0.25
echo -n .
done | zenity --progress --auto-kill
 
Old 03-25-2011, 04:07 PM   #5
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Try this:
Code:
#!/bin/bash
read -p "Enter backup name: " bname
dvdbackup -M -n $bname -o /home/seashell/Videos/Editing/DVDrip & 
pid=$!
trap "
[ -e /proc/$pid ] && kill $pid
eject /dev/dvd
" EXIT

while [ -e /proc/$pid ]; do
sleep 0.25
echo -n .
done | zenity --progress --auto-kill
 
2 members found this post helpful.
Old 03-25-2011, 04:30 PM   #6
seashell11
Member
 
Registered: Jul 2005
Distribution: Ubuntu Maverick
Posts: 86

Original Poster
Rep: Reputation: 16
You fixed! Thanks!
 
Old 03-25-2011, 04:33 PM   #7
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
No problem man!

Cheers,

Josh
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup to DVD script Gerard Lally Linux - General 5 03-12-2010 07:02 AM
Newbie trying to write a simple backup script to backup a single folder Nd for school stryker759a Linux - Newbie 2 09-16-2009 08:52 AM
Need help with script to organise files into folders as part of DVD backup script jasybee2000 Linux - Newbie 5 06-15-2009 07:29 PM
[SOLVED] script backup with multisession dvd mythcat Fedora 2 03-05-2009 02:26 AM
how to create backup MYSQL Script to backup my database for every 1hour RMLinux Linux - Newbie 3 11-20-2008 10:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:03 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