View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 109 posts ] 
Go to page Previous  1, 2, 3, 4, 5 ... 8  Next

Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject:
PostPosted: Fri Oct 06, 2006 9:19 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
mrshark wrote:
interactive mode for cp/rm/mv could be turned off with che -f switch (force), as opposed to -i (interactive).

Nope, that doesn't always work, I forget which of Solaris, AIX, HP-UX, Linux, CygWin, ... will still prompt you if you specify both "-i" (via an alias) and "-f" but I just had to help someone with that issue at work this week.

I agree in principle on the absolute paths, and in production scripts I tend to use something like:
Code:
RM=$(type -p rm)
MV=$(type -p mv)

But we're talking about a known platform (KM) here, and I didn't want to hit a scripting newbie over the head with all of the pro-level paranoia and redundant safety checking that keeps production systems producing.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 07, 2006 2:30 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
Hey TJC, I added
Code:
#!/bin/bash
and removed the lines with "y" those were for "cp" to answer yes when overwriting so I added "--reply=yes" instead.
I think the use of "nice" is great as long as you don't use MythTV for too long because it will stop everything and begin installing without warning (this isn't something I recommend for most users).
For your fatal_error function, should I replace the if statements that are already in there with it?
For the backup list, I was thinking of adding the line
Code:
echo /usr/share/mythtv > /myth/backup/backup.list
but what if someone reinstalls a newer knoppmyth with a newer MythTV and performs a restore from that? Would that overwrite their new MythTV?
Also, I don't know anything about this.
Code:
RM=$(type -p rm)
MV=$(type -p mv)


mrshark, I added absolute paths to everything I could find. For "/usr/bin/make" would it try to perform a make in /usr/bin now for still make in the current dir?

sjerome, glad to see its working for ya, have fun! :wink:

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 07, 2006 3:58 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
WattoToydarian wrote:
Also, I don't know anything about this.
Code:
RM=$(type -p rm)
MV=$(type -p mv)


You're probably happier that way. ;-) This isn't something most scripts need. It's part of a heavyweight industrial grade discipline where you get the real path to every command you're going to use (which isn't a shell builtin), verify the file six ways to Sunday, and then always use the variable name to refer to it. It's fairly tedious, and good demonstration of the engineering principle that every extra "9" (e.g. "four 9s" is 99.99%) of reliability tends to double the cost.

I would'nt replace your existing if tests, but the fatal error idiom is a really clear and easy way to add a bunch of safety checking. You can toss it in anywhere where "bad things could happen if that step failed" and it gives you a nice clear indication of where things went off the rails.

Oh, and using absolute paths to refer to commands or files doesn't affect where the actions themselves are taking place.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 07, 2006 11:25 pm 
Offline
Joined: Wed Aug 09, 2006 2:47 am
Posts: 21
WattoToydarian wrote:
removed the lines with "y" those were for "cp" to answer yes when overwriting so I added "--reply=yes" instead.

in these cases, you could also pipe "yes" to the command you want:
Code:
yes | cp -f .......

WattoToydarian wrote:
For the backup list, I was thinking of adding the line
Code:
echo /usr/share/mythtv > /myth/backup/backup.list
but what if someone reinstalls a newer knoppmyth with a newer MythTV and performs a restore from that? Would that overwrite their new MythTV?

HEY! Double that ">"!!! Or you eventually erase every user backup.list!
Code:
echo /usr/share/mythtv >> /myth/backup/backup.list

WattoToydarian wrote:
mrshark, I added absolute paths to everything I could find. For "/usr/bin/make" would it try to perform a make in /usr/bin now for still make in the current dir?

no, commands are executed in the path where you were at that moment ("pwd")

_________________
Mobo: Asus M2NPV-VM (Nvidia 430/6150 + HDTVout), bios 0405
CPU: Sempron 3GHz - 512MB Ram
TV: Asus MyCinema P7131H Hybrid + Ati Remote Wonder USB
KnoppMyth R5D1 upg. to MythTV 0.20


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 08, 2006 12:56 am 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
mrshark wrote:
HEY! Double that ">"!!! Or you eventually erase every user backup.list!
Code:
echo /usr/share/mythtv >> /myth/backup/backup.list

Good catch!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 08, 2006 1:39 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
ok I added:
Code:
echo /usr/share/mythtv >> /myth/backup/backup.list
and I put TJC's success/failure checks in it.
Does it look ok with all that :?:

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 08, 2006 5:33 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
You need to move the function definition up near the top so it's already defined when it might be used. You've got to remember that with an interpreted language like bash stuff needs to be defined textually before it's used.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 08, 2006 5:47 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
Ok I moved it to the top. I just thought that it might do something weird since it's not a command.

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 08, 2006 5:50 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Actually that's why it needs to be done before it's referenced. It is a command, that defines a function to be used later.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 08, 2006 10:19 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
OBTW - to avoid many, many occurances of /usr/share/mythtv in the backup list you should do something like this. Also note the "spelling" correction, entries in that list are supposed to start with a dot ('.')
Code:
grep /usr/share/mythtv /myth/backup/backup.list >/dev/null ||
    echo ./usr/share/mythtv >> /myth/backup/backup.list
sed -si~ -e 's:^/:./:' /myth/backup/backup.list

The sed command is there to correct any bad entries...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 2:49 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
Thanks tjc, I was actually wondering if that was gunna happen.

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
 Post subject: Scritpt worked great...
PostPosted: Sat Oct 14, 2006 7:09 am 
Offline
Joined: Thu Nov 04, 2004 6:24 am
Posts: 1
Pretty impressive. Just wondering if anyone else running on the Asus Pundit ended up with a segfault in mythfrontend? I've even tried a fully clean install, then run the script, thinking that something in the DB was messing things up. Probably an active issue with the code in SVN, I'll also check on the mythtv lists and see if anyone has the same issue.

~cj


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 14, 2006 12:41 pm 
Offline
Joined: Tue Jun 21, 2005 6:09 pm
Posts: 57
It looks like the website http://watto.homeip.net is not responding any chance the script is available somewhere else?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 14, 2006 2:13 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
[quote="connollyr12"]It looks like the website http://watto.homeip.net is not responding any chance the script is available somewhere else?[/quote]My IP address just changed, try it again.

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
PostPosted: Sat Oct 14, 2006 2:21 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
[quote="cmaahs"]Pretty impressive. Just wondering if anyone else running on the Asus Pundit ended up with a segfault in mythfrontend? I've even tried a fully clean install, then run the script, thinking that something in the DB was messing things up. Probably an active issue with the code in SVN, I'll also check on the mythtv lists and see if anyone has the same issue.

~cj[/quote]
I agree with your conclusion about the code in svn.
You also might want to try removing the mythtv packages after knoppmyth installation, reinstalling the mythconverg database, and then installing from svn and see if that works.

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 109 posts ] 
Go to page Previous  1, 2, 3, 4, 5 ... 8  Next



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu