From sean at tinfoilhat.ca Thu Jul 1 15:29:12 2010 From: sean at tinfoilhat.ca (Sean Cody) Date: Thu, 1 Jul 2010 15:29:12 -0500 Subject: [RndTbl] Encrypt files/info/whatever easily. Message-ID: So yeah this is normally something I would reserve for the newsletter but the inspiration hit me and I'll forget by September. :P So say someone wants to tell you something secret or you need to write down a secret in a file but don't want it in plaintext. Well using the shell & openssl [installed by default on OS X and probably on Linux [I know it's default on *BSD]]... Assuming your shell is SH derrivitive.. #cat << EOL | openssl aes-256-cbc -a -salt -out secret.txt OMG I haz a secretz! EOL (password will be requested here) # Notice I'm using what is referred to as a HEREDOC and piping it to openssl chosing the aes-256-cbc cipher. The -a parameter just says the input is in base64. -salt is well salting the cipher. So how do you get that back? #openssl aes-256-cbc -d -a -in secret.txt (password will be requested here) OMG I haz a secretz! # In this case -d is well... decrypt. You can replace the cat pipeline with -in somefile.txt if you want to do files themselves but this way no plaintext hits the disk (unless you shell swaps... which you have other issues then. :P). This is awesome because you don't have to install something special (ie. truecrypt) for a quick encrypt and you can store the data set anywhere and pull it (say via wget with pipelining) from random places with openssl installed to decrypt. Not really suggested for super secret stuff but it can be pretty handy... especially when passing around messages in a MacGyver sneaker net style situation. -- Sean From sean at tinfoilhat.ca Thu Jul 1 16:10:50 2010 From: sean at tinfoilhat.ca (Sean Cody) Date: Thu, 1 Jul 2010 16:10:50 -0500 Subject: [RndTbl] Encrypt files/info/whatever easily. In-Reply-To: References: Message-ID: And for more insanity... Write a secret message, filter it through openssl and ship it via an HTTP proxy to a listener on host:1337. echo << EOL | openssl aes-256-cbc -a -salt > /tmp/ secretz.in && nc proxy:8080 -Xconnect host 1337 < /tmp/secretz.in && rm /tmp/secretz.in Bonus points for anyone using the above to tunnel via DNS TXT records. :P OpenSSL was being weird on my side with the client end so I'll leave that as an excursive to the reader (hint, use files or a fifo/named pipe). If you really want to screw with your packet nazi security team... while true; do openssl rand -base64 $RANDOM | awk '{s=s $0;}END{print s}' | openssl aes-256-cbc -a -salt > /tmp/ secretz.in && nc proxy:8080 -Xconnect host 1337 < /tmp/secretz.in && rm /tmp/secretz.in sleep $RANDOM done; On 2010-07-01, at 3:29 PM, Sean Cody wrote: > So yeah this is normally something I would reserve for the newsletter but the inspiration hit me and I'll forget by September. :P > > So say someone wants to tell you something secret or you need to write down a secret in a file but don't want it in plaintext. > Well using the shell & openssl [installed by default on OS X and probably on Linux [I know it's default on *BSD]]... > > Assuming your shell is SH derrivitive.. > > > #cat << EOL | openssl aes-256-cbc -a -salt -out secret.txt > OMG I haz a secretz! > EOL > (password will be requested here) > # > > Notice I'm using what is referred to as a HEREDOC and piping it to openssl chosing the aes-256-cbc cipher. > The -a parameter just says the input is in base64. -salt is well salting the cipher. > So how do you get that back? > > #openssl aes-256-cbc -d -a -in secret.txt > (password will be requested here) > OMG I haz a secretz! > # > > In this case -d is well... decrypt. > > You can replace the cat pipeline with -in somefile.txt if you want to do files themselves but this way no plaintext hits the disk (unless you shell swaps... which you have other issues then. :P). > > This is awesome because you don't have to install something special (ie. truecrypt) for a quick encrypt and you can store the data set anywhere and pull it (say via wget with pipelining) from random places with openssl installed to decrypt. Not really suggested for super secret stuff but it can be pretty handy... especially when passing around messages in a MacGyver sneaker net style situation. > > -- > Sean > > > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable -- Sean From athompso at athompso.net Fri Jul 2 12:01:26 2010 From: athompso at athompso.net (Adam Thompson) Date: Fri, 2 Jul 2010 12:01:26 -0500 Subject: [RndTbl] high-power 802.11g router recommendations? Message-ID: <001201cb1a08$35b00620$a1101260$@net> Looking for recommendations for a wireless router than has better-than-usual range. I?ve used the Buffalo WHR-HP-G54 with good results, but they?re basically impossible to find locally. I?ve also now experienced the D-Link DIR-825?s pathetic range, not sure I want to trust D-Link?s RangeBooster line without first-hand recommendations. Any suggestions? Thanks, -Adam From sean at tinfoilhat.ca Fri Jul 2 12:22:00 2010 From: sean at tinfoilhat.ca (Sean Cody) Date: Fri, 2 Jul 2010 12:22:00 -0500 Subject: [RndTbl] high-power 802.11g router recommendations? In-Reply-To: <001201cb1a08$35b00620$a1101260$@net> References: <001201cb1a08$35b00620$a1101260$@net> Message-ID: <4452C71E-CDF0-46EF-AF15-9821477A7C6B@tinfoilhat.ca> I reccomend (yeah not in production but if you can find one it is worth it): WRT54-G FTW! Love it. I have a D-LINK 825... CRAP, or my ducting is killing N singles (using 5dbi aftermarket antennas, better than the 3dbi it came with but not much) I used to use and use for great mischief a Soekris NET4501 (re-branded and modded for wifi by FireTide) + 200mW compact PCI ralink + 5 dbi TNC antennas running OpenBSD. The NetGear WDR series is getting some good reviews... smallnetbuilder.com isn't terrible and their charts are pretty good. On 2010-07-02, at 12:01 PM, Adam Thompson wrote: > Looking for recommendations for a wireless router than has better-than-usual range. > > I?ve used the Buffalo WHR-HP-G54 with good results, but they?re basically impossible to find locally. > > I?ve also now experienced the D-Link DIR-825?s pathetic range, not sure I want to trust D-Link?s RangeBooster line without first-hand recommendations. > > Any suggestions? > > Thanks, > -Adam > > > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable -- Sean From sean at ertw.com Fri Jul 2 12:43:31 2010 From: sean at ertw.com (Sean Walberg) Date: Fri, 2 Jul 2010 12:43:31 -0500 Subject: [RndTbl] high-power 802.11g router recommendations? In-Reply-To: <001201cb1a08$35b00620$a1101260$@net> References: <001201cb1a08$35b00620$a1101260$@net> Message-ID: I've got a linksys 610N that seems to have good range. It's hanging on a wall in the basement and I get a good signal on the top floor of a 2 story. The usb storagelink is a piece of garbage though. Sean On Fri, Jul 2, 2010 at 12:01 PM, Adam Thompson wrote: > Looking for recommendations for a wireless router than has > better-than-usual range. > > I?ve used the Buffalo WHR-HP-G54 with good results, but they?re basically > impossible to find locally. > > I?ve also now experienced the D-Link DIR-825?s pathetic range, not sure I > want to trust D-Link?s RangeBooster line without first-hand recommendations. > > Any suggestions? > > Thanks, > -Adam > > > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable > -- Sean Walberg http://ertw.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.muug.mb.ca/pipermail/roundtable/attachments/20100702/60c356a9/attachment.html From billreid at shaw.ca Fri Jul 2 12:54:20 2010 From: billreid at shaw.ca (Bill Reid) Date: Fri, 02 Jul 2010 12:54:20 -0500 Subject: [RndTbl] high-power 802.11g router recommendations? In-Reply-To: <001201cb1a08$35b00620$a1101260$@net> References: <001201cb1a08$35b00620$a1101260$@net> Message-ID: <4C2E27CC.6030100@shaw.ca> I am using the Linksys WRT610N but have not been impressed with the range. Not really much better than the 54G. I tried the Netgear WNR3500 but it had no better range. I settled with using the Buffallo WZR-HP-G300NH in access point mode. The Buffallo's range a bit better than the Linksys but I have the Linksys on the 3rd floor and the Buffallo in the basement so the coverage is ok. -- Bill On 07/02/2010 12:01 PM, Adam Thompson wrote: > Looking for recommendations for a wireless router than has better-than-usual range. > > I?ve used the Buffalo WHR-HP-G54 with good results, but they?re basically impossible to find locally. > > I?ve also now experienced the D-Link DIR-825?s pathetic range, not sure I want to trust D-Link?s RangeBooster line without first-hand recommendations. > > Any suggestions? > > Thanks, > -Adam > > > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable From ve4drk at gmail.com Fri Jul 2 14:16:12 2010 From: ve4drk at gmail.com (Dan Keizer) Date: Fri, 2 Jul 2010 14:16:12 -0500 Subject: [RndTbl] high-power 802.11g router recommendations? In-Reply-To: <4C2E27CC.6030100@shaw.ca> References: <001201cb1a08$35b00620$a1101260$@net> <4C2E27CC.6030100@shaw.ca> Message-ID: I've always used the WRT series of routers for the most part -- they have generally done me quite well in and around the house. If you're looking for increasing the signal quality or the range, the first thing to look at is the antenna setup. Depending on the model of router you have, you would most likely get better results by purchasing an aftermarket replacement antenna -- these can increase the gain of the antennas for both transmission and reception ... don't just pump up the power output on the router -- that would just increase the transmission, but not the reception -- and if you do pump it up too much, you could damage the finals. If you can, you can pick up a more directional antenna and put it at the end of the house so to speak and see how that performs for your needs ... I'd take a look at the current spectrum usage in your area .. what channels are in use etc ... use channels that are not occupied that much if you can. certainly, I've had interference from both my hand-held portable phones and the microwave at times .. so those are considerations too ... you can use different phone technology to get around the 2.4GHz band ... dect phones are the newer ones it seems. On Fri, Jul 2, 2010 at 12:54 PM, Bill Reid wrote: > I am using the Linksys WRT610N but have not been impressed with the range. Not > really much better than the 54G. I tried the Netgear WNR3500 but it had no > better range. I settled with using the Buffallo WZR-HP-G300NH in access point > mode. The Buffallo's range a bit better than the Linksys but I have the Linksys > on the 3rd floor and the Buffallo in the basement so the coverage is ok. > > -- Bill > > On 07/02/2010 12:01 PM, Adam Thompson wrote: >> Looking for recommendations for a wireless router than has better-than-usual range. >> >> I?ve used the Buffalo WHR-HP-G54 with good results, but they?re basically impossible to find locally. >> >> I?ve also now experienced the D-Link DIR-825?s pathetic range, not sure I want to trust D-Link?s RangeBooster line without first-hand recommendations. >> >> Any suggestions? >> >> Thanks, >> -Adam >> >> >> >> _______________________________________________ >> Roundtable mailing list >> Roundtable at muug.mb.ca >> http://www.muug.mb.ca/mailman/listinfo/roundtable > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable > From wyatt at prairieturtle.ca Fri Jul 2 15:28:49 2010 From: wyatt at prairieturtle.ca (Daryl F) Date: Fri, 2 Jul 2010 15:28:49 -0500 (CDT) Subject: [RndTbl] high-power 802.11g router recommendations? In-Reply-To: <001201cb1a08$35b00620$a1101260$@net> References: <001201cb1a08$35b00620$a1101260$@net> Message-ID: On Fri, 2 Jul 2010, Adam Thompson wrote: > Looking for recommendations for a wireless router than has better-than-usual range. > > I?ve used the Buffalo WHR-HP-G54 with good results, but they?re basically impossible to find locally. > > I?ve also now experienced the D-Link DIR-825?s pathetic range, not sure I want to trust D-Link?s RangeBooster line without first-hand recommendations. > > Any suggestions? > > Thanks, > -Adam I can't really recommended one device over another but I will share something I learned about increasing range: most wireless router firmware shipped to/produced in Canada adheres to FCC standards which requires a lower radiated power than CRTC allows. CRTC follows Europe. If there is European firmware available for the router you choose, use it. It may give you more output power without risking any damage to the device. -Daryl From sean at ertw.com Fri Jul 2 17:47:08 2010 From: sean at ertw.com (Sean Walberg) Date: Fri, 2 Jul 2010 17:47:08 -0500 Subject: [RndTbl] high-power 802.11g router recommendations? In-Reply-To: References: <001201cb1a08$35b00620$a1101260$@net> Message-ID: On Fri, Jul 2, 2010 at 3:28 PM, Daryl F wrote: > > I can't really recommended one device over another but I will share > something I learned about increasing range: most wireless router firmware > shipped to/produced in Canada adheres to FCC standards which requires a > lower radiated power than CRTC allows. CRTC follows Europe. If there is > European firmware available for the router you choose, use it. It may give > you more output power without risking any damage to the device. I was at a presentation at SharkFest that explained some of this. http://www.cacetech.com/sharkfest.10/B-9_Bardwell-Secrets_Revealed-PART_2.pdf is the slides. Look at the top slide of page 11 about the 5GHz U-NII channels. Some manufacturers implement the higher classes which let you go at more power, but not all countries allow the different frequencies to be used. Sean -- Sean Walberg http://ertw.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.muug.mb.ca/pipermail/roundtable/attachments/20100702/012bedb8/attachment.html From athompso at athompso.net Tue Jul 6 23:07:35 2010 From: athompso at athompso.net (Adam Thompson) Date: Tue, 6 Jul 2010 23:07:35 -0500 Subject: [RndTbl] bash expansion question Message-ID: <004c01cb1d89$eeff39a0$ccfdace0$@net> I can't find what I'm looking for in the bash(1) manpage, hoping there's an easy answer... I want to use a construct like for i in ~/path/*; do something $i && rm $i; done which works great as long as there are files in ~/path/. However, when the directory is empty, I get: rm: cannot remove `/home/athompso/path/*': No such file or directory which isn't quite what I want. The quick fix in this case is to use for i in ~/path/*; do [ -f $i ] && something $i && rm $i; done but once again, that strikes me as inelegant and I can't remember OR find the better way to do it. Anyone? Thanks, -Adam From robert at cluenet.org Wed Jul 7 01:45:12 2010 From: robert at cluenet.org (Robert Keizer) Date: Wed, 07 Jul 2010 02:45:12 -0400 Subject: [RndTbl] bash expansion question In-Reply-To: <004c01cb1d89$eeff39a0$ccfdace0$@net> References: <004c01cb1d89$eeff39a0$ccfdace0$@net> Message-ID: Try this: for i in `ls /path/to/dir`; do # i is set here, only when it contains something.. echo $i; done; From robert at cluenet.org Wed Jul 7 02:02:14 2010 From: robert at cluenet.org (Robert Keizer) Date: Wed, 07 Jul 2010 03:02:14 -0400 Subject: [RndTbl] bash expansion question In-Reply-To: <004c01cb1d89$eeff39a0$ccfdace0$@net> References: <004c01cb1d89$eeff39a0$ccfdace0$@net> Message-ID: Adam Thompson writes: > I can't find what I'm looking for in the bash(1) manpage, hoping there's an > easy answer... > > I want to use a construct like > for i in ~/path/*; do something $i && rm $i; done > > which works great as long as there are files in ~/path/. However, when the > directory is empty, I get: > rm: cannot remove `/home/athompso/path/*': No such file or directory > > which isn't quite what I want. The quick fix in this case is to use > for i in ~/path/*; do [ -f $i ] && something $i && rm $i; done > > but once again, that strikes me as inelegant and I can't remember OR find > the better way to do it. > > Anyone? > > Thanks, > -Adam for i in `ls /path/to/dir`; do do something $i; rm $i; done; If you need the power of regular expressions I would just use grep.. although the way you're using it doesn't look like its necessary. IE for i in `ls /dev | grep tty`; do echo -n $i; done; My last reply didn't go through ( I'm guessing due to the length. ) Hence the random blathering at 2AM to lengthen this one... All the best, Robert Keizer From trevor at tecnopolis.ca Wed Jul 7 02:22:23 2010 From: trevor at tecnopolis.ca (Trevor Cordes) Date: Wed, 7 Jul 2010 02:22:23 -0500 Subject: [RndTbl] bash expansion question In-Reply-To: <004c01cb1d89$eeff39a0$ccfdace0$@net> References: <004c01cb1d89$eeff39a0$ccfdace0$@net> Message-ID: <20100707022223.7e616cd9@pog.tecnopolis.ca> On 2010-07-06 Adam Thompson wrote: > I can't find what I'm looking for in the bash(1) manpage, hoping > there's an easy answer... > > I want to use a construct like > for i in ~/path/*; do something $i && rm $i; done > > which works great as long as there are files in ~/path/. However, > when the directory is empty, I get: > rm: cannot remove `/home/athompso/path/*': No such file or > directory What you want is: shopt -s failglob for i in /tmp/A/* /dev/null; do echo $i; done bash: no match: /tmp/A/* # gives an error but doesn't exec the do clause or shopt -s nullglob for i in /tmp/A/* ; do echo $i; done # outputs nothing, executes no do clause Using these options lets you still do sane arg quoting in case there are spaces in filenames, etc. From sean at ertw.com Wed Jul 7 07:30:04 2010 From: sean at ertw.com (Sean Walberg) Date: Wed, 7 Jul 2010 07:30:04 -0500 Subject: [RndTbl] bash expansion question In-Reply-To: <004c01cb1d89$eeff39a0$ccfdace0$@net> References: <004c01cb1d89$eeff39a0$ccfdace0$@net> Message-ID: [sean at sergeant:~]$ mkdir /tmp/nothing [sean at sergeant:~]$ ls /tmp/nothing | while read A; do echo $A; done [sean at sergeant:~]$ Also gets around nasty "argument list too long" messages and doesn't need you to remember arcane syntax. $A is quotable if you have spaces in the filename. Sean On Tue, Jul 6, 2010 at 11:07 PM, Adam Thompson wrote: > I can't find what I'm looking for in the bash(1) manpage, hoping there's an > easy answer... > > I want to use a construct like > for i in ~/path/*; do something $i && rm $i; done > > which works great as long as there are files in ~/path/. However, when the > directory is empty, I get: > rm: cannot remove `/home/athompso/path/*': No such file or directory > > which isn't quite what I want. The quick fix in this case is to use > for i in ~/path/*; do [ -f $i ] && something $i && rm $i; done > > but once again, that strikes me as inelegant and I can't remember OR find > the better way to do it. > > Anyone? > > Thanks, > -Adam > > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable > -- Sean Walberg http://ertw.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.muug.mb.ca/pipermail/roundtable/attachments/20100707/eb140df5/attachment.html From ve4per at aim.com Wed Jul 7 12:10:29 2010 From: ve4per at aim.com (VE4ER / Andy) Date: Wed, 07 Jul 2010 17:10:29 +0000 Subject: [RndTbl] script for file copy Message-ID: <4C34B505.6000903@aim.com> Can anybody suggest a script to copy files from one directory structure to another changing the filename in the process to include the original folder names, but only if an actual file with extension exists in the bottom child folder : Go from : Master Folder ------> Sub Folder1 -----> Sub Sub Folder1 ---> filename.example ------> Sub Folder2 -----> Sub Sub Folder1 ---> filename.example ------> Sub Folder2 -----> Sub Sub Folder2 ---> filename.example To: /Var/MainFolder/Master_Sub1_SubSub1_filename.example /Var/MainFolder/Master_Sub2_SubSub1_filename.example /Var/MainFolder/Master_Sub2_SubSub2_filename.example ....etc Thanks Andy From athompso at athompso.net Wed Jul 7 14:09:12 2010 From: athompso at athompso.net (Adam Thompson) Date: Wed, 7 Jul 2010 14:09:12 -0500 Subject: [RndTbl] script for file copy In-Reply-To: <4C34B505.6000903@aim.com> References: <4C34B505.6000903@aim.com> Message-ID: <002801cb1e07$e2dd4f30$a897ed90$@athompso.net> I've had to do this before... there are some tools that'll do it for you, essentially you want the UNIX version of MS-DOS's "UPDATE" command. I would look at "rsync", used in local mode, use something like $ rsync -a --existing SRCDIR DSTDIR It is of course possible to do this in a shell script, but it's tricky to handle the recursion correctly unless you use an iterative find/grep series, which gets very expensive in terms of CPU time. The best non-recursive technique I can think of would be something like: #!/bin/sh SRC="$1" DST="$2" T1=$(mktemp) T2=$(mktemp) find "${SRC}" -type f -print | sed -e "s/^${SRC}//" | sort > "${T1}" find "${DST}" -type f -print | sed -e "s/^${DST}//" | sort > "${T1}" comm -12 "$T1" "$T2" | while read F ; do cp "${SRCDIR}${F}" "${DSTDIR}${F}" done -Adam > -----Original Message----- > From: roundtable-bounces at muug.mb.ca [mailto:roundtable- > bounces at muug.mb.ca] On Behalf Of VE4ER / Andy > Sent: Wednesday, July 07, 2010 12:10 PM > To: MUUG Roundtable > Subject: [RndTbl] script for file copy > > Can anybody suggest a script to copy files from one directory structure to > another changing the filename in the process to include the original > folder names, but only if an actual file with extension exists in the > bottom child folder : > > Go from : > > Master Folder ------> Sub Folder1 -----> Sub Sub Folder1 ---> > filename.example > ------> Sub Folder2 -----> Sub Sub Folder1 ---> > filename.example > ------> Sub Folder2 -----> Sub Sub Folder2 ---> > filename.example > > > To: > > /Var/MainFolder/Master_Sub1_SubSub1_filename.example > /Var/MainFolder/Master_Sub2_SubSub1_filename.example > /Var/MainFolder/Master_Sub2_SubSub2_filename.example ....etc > > > Thanks > Andy > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable From trevor at tecnopolis.ca Wed Jul 7 14:40:01 2010 From: trevor at tecnopolis.ca (Trevor Cordes) Date: Wed, 7 Jul 2010 14:40:01 -0500 Subject: [RndTbl] script for file copy In-Reply-To: <4C34B505.6000903@aim.com> References: <4C34B505.6000903@aim.com> Message-ID: <20100707144001.17e5edb4@pog.tecnopolis.ca> On 2010-07-07 VE4ER / Andy wrote: > Can anybody suggest a script to copy files from one directory > structure to another changing the filename in the process to include > the original folder names, but only if an actual file with extension > exists in the bottom child folder : > > Go from : > > Master Folder ------> Sub Folder1 -----> Sub Sub Folder1 ---> > filename.example > ------> Sub Folder2 -----> Sub Sub Folder1 > ---> filename.example > ------> Sub Folder2 -----> Sub Sub Folder2 > ---> filename.example > > To: > > /Var/MainFolder/Master_Sub1_SubSub1_filename.example Use my "rename" script, evolved from the Programming Perl O'Reilly book example of the same name: cat /usr/local/script/rename #!/usr/bin/perl -w # From page 313 of Programming Perl # Renames a group of files, ie *.c -> *.bak# Usage: rename perlexpr[files] ($op=shift) || die "Usage: rename perlexpr [filenames]\n"; if (!@ARGV){ @ARGV=; chop(@ARGV); } for (@ARGV){ $was=$_; eval $op; die $@ if $@; warn("file does not exist: $was\n"),next if ! -e $was; rename($was,$_) unless $was eq $_; print "$was -> $_".($was eq $_ and ' the same, no rename done')."\n"; } and then call it like: find . -type f -name "*.example" | rename 's#(? References: <4C34B505.6000903@aim.com> Message-ID: <002f01cb1e0c$f487c350$dd9749f0$@athompso.net> Umm... I think I misunderstood the original question. You want to flatten a directory structure into a single directory while preserving a record of the original path encoded in the filename. I think this would do what you want: find "${SRC}" -type f -print | while read F1; do F2=$( echo "${F1}" | tr '/' '_' ) mv "${F1}" "${F2}" done -Adam > -----Original Message----- > From: Adam Thompson [mailto:athompso at athompso.net] > Sent: Wednesday, July 07, 2010 2:09 PM > To: 'Continuation of Round Table discussion' > Subject: RE: [RndTbl] script for file copy > > I've had to do this before... there are some tools that'll do it for you, > essentially you want the UNIX version of MS-DOS's "UPDATE" command. > I would look at "rsync", used in local mode, use something like > > $ rsync -a --existing SRCDIR DSTDIR > > It is of course possible to do this in a shell script, but it's tricky to handle > the recursion correctly unless you use an iterative find/grep series, which > gets very expensive in terms of CPU time. > > The best non-recursive technique I can think of would be something like: > #!/bin/sh > SRC="$1" > DST="$2" > T1=$(mktemp) > T2=$(mktemp) > find "${SRC}" -type f -print | sed -e "s/^${SRC}//" | sort > "${T1}" > find "${DST}" -type f -print | sed -e "s/^${DST}//" | sort > "${T1}" > comm -12 "$T1" "$T2" | while read F ; do > cp "${SRCDIR}${F}" "${DSTDIR}${F}" > done > > -Adam > > > -----Original Message----- > > From: roundtable-bounces at muug.mb.ca [mailto:roundtable- > > bounces at muug.mb.ca] On Behalf Of VE4ER / Andy > > Sent: Wednesday, July 07, 2010 12:10 PM > > To: MUUG Roundtable > > Subject: [RndTbl] script for file copy > > > > Can anybody suggest a script to copy files from one directory > > structure to another changing the filename in the process to include > > the original folder names, but only if an actual file with extension > > exists in the bottom child folder : > > > > Go from : > > > > Master Folder ------> Sub Folder1 -----> Sub Sub Folder1 ---> > > filename.example > > ------> Sub Folder2 -----> Sub Sub Folder1 > > ---> filename.example > > ------> Sub Folder2 -----> Sub Sub Folder2 > > ---> filename.example > > > > > > To: > > > > /Var/MainFolder/Master_Sub1_SubSub1_filename.example > > /Var/MainFolder/Master_Sub2_SubSub1_filename.example > > /Var/MainFolder/Master_Sub2_SubSub2_filename.example > ....etc > > > > > > Thanks > > Andy > > > > _______________________________________________ > > Roundtable mailing list > > Roundtable at muug.mb.ca > > http://www.muug.mb.ca/mailman/listinfo/roundtable From trevor at tecnopolis.ca Wed Jul 7 14:53:31 2010 From: trevor at tecnopolis.ca (Trevor Cordes) Date: Wed, 7 Jul 2010 14:53:31 -0500 Subject: [RndTbl] script for file copy In-Reply-To: <002f01cb1e0c$f487c350$dd9749f0$@athompso.net> References: <4C34B505.6000903@aim.com> <002f01cb1e0c$f487c350$dd9749f0$@athompso.net> Message-ID: <20100707145331.71542d38@pog.tecnopolis.ca> On 2010-07-07 Adam Thompson wrote: > Umm... I think I misunderstood the original question. You want to > flatten a directory structure into a single directory while > preserving a record of the original path encoded in the filename. > > I think this would do what you want: > > find "${SRC}" -type f -print | while read F1; do > F2=$( echo "${F1}" | tr '/' '_' ) > mv "${F1}" "${F2}" > done Has the same problem I ran into (before using perl negative look-behinds) of converting the leading slash to _. (ie if SRC = ".") From athompso at athompso.net Wed Jul 7 14:57:43 2010 From: athompso at athompso.net (Adam Thompson) Date: Wed, 7 Jul 2010 19:57:43 +0000 Subject: [RndTbl] script for file copy In-Reply-To: <20100707145331.71542d38@pog.tecnopolis.ca> References: <4C34B505.6000903@aim.com><002f01cb1e0c$f487c350$dd9749f0$@athompso.net><20100707145331.71542d38@pog.tecnopolis.ca> Message-ID: <949692458-1278532652-cardhu_decombobulator_blackberry.rim.net-1975974143-@bda957.bisx.prod.on.blackberry> So? If SRC=. then the filesnames all become ._whatever. Which is precisely the designed behaviour, in my mind. Admittedly, that's a classic anti-example of the famous DWIM design principle... -Adam -----Original Message----- From: Trevor Cordes Sender: roundtable-bounces at muug.mb.ca Date: Wed, 7 Jul 2010 14:53:31 To: Reply-To: Continuation of Round Table discussion Subject: Re: [RndTbl] script for file copy On 2010-07-07 Adam Thompson wrote: > Umm... I think I misunderstood the original question. You want to > flatten a directory structure into a single directory while > preserving a record of the original path encoded in the filename. > > I think this would do what you want: > > find "${SRC}" -type f -print | while read F1; do > F2=$( echo "${F1}" | tr '/' '_' ) > mv "${F1}" "${F2}" > done Has the same problem I ran into (before using perl negative look-behinds) of converting the leading slash to _. (ie if SRC = ".") _______________________________________________ Roundtable mailing list Roundtable at muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable From kevin.a.mcgregor at gmail.com Wed Jul 7 15:16:37 2010 From: kevin.a.mcgregor at gmail.com (Kevin McGregor) Date: Wed, 7 Jul 2010 15:16:37 -0500 Subject: [RndTbl] script for file copy In-Reply-To: <002801cb1e07$e2dd4f30$a897ed90$@athompso.net> References: <4C34B505.6000903@aim.com> <002801cb1e07$e2dd4f30$a897ed90$@athompso.net> Message-ID: Great, but he will still want the slashes converted to underscores, will he not? I hope he doesn't have any underscores already in any directory or file names, else it will be non-reversible (and a little confusing). Kevin On Wed, Jul 7, 2010 at 2:09 PM, Adam Thompson wrote: > I've had to do this before... there are some tools that'll do it for you, > essentially you want the UNIX version of MS-DOS's "UPDATE" command. > I would look at "rsync", used in local mode, use something like > > $ rsync -a --existing SRCDIR DSTDIR > > It is of course possible to do this in a shell script, but it's tricky to > handle the recursion correctly unless you use an iterative find/grep series, > which gets very expensive in terms of CPU time. > > The best non-recursive technique I can think of would be something like: > #!/bin/sh > SRC="$1" > DST="$2" > T1=$(mktemp) > T2=$(mktemp) > find "${SRC}" -type f -print | sed -e "s/^${SRC}//" | sort > "${T1}" > find "${DST}" -type f -print | sed -e "s/^${DST}//" | sort > "${T1}" > comm -12 "$T1" "$T2" | while read F ; do > cp "${SRCDIR}${F}" "${DSTDIR}${F}" > done > > -Adam > > > -----Original Message----- > > From: roundtable-bounces at muug.mb.ca [mailto:roundtable- > > bounces at muug.mb.ca] On Behalf Of VE4ER / Andy > > Sent: Wednesday, July 07, 2010 12:10 PM > > To: MUUG Roundtable > > Subject: [RndTbl] script for file copy > > > > Can anybody suggest a script to copy files from one directory structure > to > > another changing the filename in the process to include the original > > folder names, but only if an actual file with extension exists in the > > bottom child folder : > > > > Go from : > > > > Master Folder ------> Sub Folder1 -----> Sub Sub Folder1 ---> > > filename.example > > ------> Sub Folder2 -----> Sub Sub Folder1 ---> > > filename.example > > ------> Sub Folder2 -----> Sub Sub Folder2 ---> > > filename.example > > > > > > To: > > > > /Var/MainFolder/Master_Sub1_SubSub1_filename.example > > /Var/MainFolder/Master_Sub2_SubSub1_filename.example > > /Var/MainFolder/Master_Sub2_SubSub2_filename.example ....etc > > > > > > Thanks > > Andy > > > > _______________________________________________ > > Roundtable mailing list > > Roundtable at muug.mb.ca > > http://www.muug.mb.ca/mailman/listinfo/roundtable > > > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.muug.mb.ca/pipermail/roundtable/attachments/20100707/08d53f16/attachment-0001.html From high.res.mike at gmail.com Tue Jul 13 11:46:43 2010 From: high.res.mike at gmail.com (Mike Pfaiffer) Date: Tue, 13 Jul 2010 11:46:43 -0500 Subject: [RndTbl] Request confirmation... Message-ID: <4C3C9873.50000@gmail.com> Someone we all know phoned me last night with some disturbing news. Unfortunately it doesn't pass the D.I.M.S. test (Does It Make Sense). He wanted some confirmation before "flying off the handle". He said he had a couple of clients phone up saying MTS was threatening Linux users with disconnection unless they switched to an all M$ environment. I said I'd pass along the request and see what people say. My suspicion is MTS is saying the same thing to Linux users as they are saying to Windows 2000 users. Namely a) Direct connections will no longer be supported with the next generation of MTS software (older software may still work). b) Tech support will be cancelled for that particular operating system. c) Although the problem with connection will be fixed with a router, the router MUST be purchased from MTS for maximum compatibility. d) They will not sell their routers to people running unsupported operating systems. e) Install techs will not be trained or permitted to connect machines with unsupported operating systems. OTOH, it could be a hoax. Time will tell... Later Mike From sean at tinfoilhat.ca Tue Jul 13 12:24:41 2010 From: sean at tinfoilhat.ca (Sean Cody) Date: Tue, 13 Jul 2010 12:24:41 -0500 Subject: [RndTbl] Request confirmation... In-Reply-To: <4C3C9873.50000@gmail.com> References: <4C3C9873.50000@gmail.com> Message-ID: <86E5EFA4-EA4D-4FBC-903E-98EEB0C16913@tinfoilhat.ca> I would say there is a thread of truth here but with respect to SUPPORT. MTS barely supports what they say they do and their 'special PPPoE' stuff is just that... special. Built in PPPoE support should continue to work unless they are migrating to something non-standard or require some extra PPPoE options that are not available to the publicly available implementations. MTS never supported Linux... never will unless 99% of their customers switch. Plus they are a "who can we call when stuff breaks" kind of shop with respect to infrastructure engineering which is kind of counter-culture to a FOSS stack. Should MTS be that aggressive then they will lose those customers... that's kind of a given and I feel for those who have no other options. Having left MTS 8 years ago and seeing how the place worked, I will personally never use their ISP again unless it is literally the only option available. The few people that had a clue were either incentivized to not use their clues for great service or were depressed politically so while the person probably had the worst possible agent speak to them I don't think the situation is as described other than the facts of MTS not supporting anything aside from their narrow band of training. MTS (when I was there, stuff may have changed) didn't support routers of any kind or shape so it doesn't surprise me they don't support them now. Note, LES.NET will provide DSL IP services using MTS' backhaul so that is an option for those DSL is the only option kind of situations. On 2010-07-13, at 11:46 AM, Mike Pfaiffer wrote: > Someone we all know phoned me last night with some disturbing news. > Unfortunately it doesn't pass the D.I.M.S. test (Does It Make Sense). He > wanted some confirmation before "flying off the handle". He said he had > a couple of clients phone up saying MTS was threatening Linux users with > disconnection unless they switched to an all M$ environment. I said I'd > pass along the request and see what people say. > > My suspicion is MTS is saying the same thing to Linux users as they are > saying to Windows 2000 users. Namely a) Direct connections will no > longer be supported with the next generation of MTS software (older > software may still work). b) Tech support will be cancelled for that > particular operating system. c) Although the problem with connection > will be fixed with a router, the router MUST be purchased from MTS for > maximum compatibility. d) They will not sell their routers to people > running unsupported operating systems. e) Install techs will not be > trained or permitted to connect machines with unsupported operating systems. > > OTOH, it could be a hoax. Time will tell... > > Later > Mike > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable -- Sean From high.res.mike at gmail.com Tue Jul 13 13:07:19 2010 From: high.res.mike at gmail.com (Mike Pfaiffer) Date: Tue, 13 Jul 2010 13:07:19 -0500 Subject: [RndTbl] Request confirmation... In-Reply-To: <86E5EFA4-EA4D-4FBC-903E-98EEB0C16913@tinfoilhat.ca> References: <4C3C9873.50000@gmail.com> <86E5EFA4-EA4D-4FBC-903E-98EEB0C16913@tinfoilhat.ca> Message-ID: <4C3CAB57.8070206@gmail.com> On 10-07-13 12:24 PM, Sean Cody wrote: > I would say there is a thread of truth here but with respect to SUPPORT. > > MTS barely supports what they say they do and their 'special PPPoE' stuff is just that... special. > Built in PPPoE support should continue to work unless they are migrating to something non-standard or require some extra PPPoE options that are not available to the publicly available implementations. > > MTS never supported Linux... never will unless 99% of their customers switch. > Plus they are a "who can we call when stuff breaks" kind of shop with respect to infrastructure engineering which is kind of counter-culture to a FOSS stack. > > Should MTS be that aggressive then they will lose those customers... that's kind of a given and I feel for those who have no other options. > Having left MTS 8 years ago and seeing how the place worked, I will personally never use their ISP again unless it is literally the only option available. > The few people that had a clue were either incentivized to not use their clues for great service or were depressed politically so while the person probably had the worst possible agent speak to them I don't think the situation is as described other than the facts of MTS not supporting anything aside from their narrow band of training. What you say makes more sense. This is closer to what I've been seeing. I can relate to your experience with MTS too. The first tier aren't allowed to do anything useful. The second tier don't know much more either. At least when tech support was here in Winnipeg we were able to get the occasional straight forward answer. > MTS (when I was there, stuff may have changed) didn't support routers of any kind or shape so it doesn't surprise me they don't support them now. They support routers now. Only the ones they sell though. They gave another friend a hard time because he kept using his old router when he made a switch from Shaw to MTS. One client from the CLL was told to return a router purchased from CBit and buy a more expensive one from MTS before they would connect the clients system. > Note, LES.NET will provide DSL IP services using MTS' backhaul so that is an option for those DSL is the only option kind of situations. Do you have any "literature" I can pass along to the CLL? There are still a few people which can't get Shaw. This may be an alternative. Later Mike > On 2010-07-13, at 11:46 AM, Mike Pfaiffer wrote: > >> Someone we all know phoned me last night with some disturbing news. >> Unfortunately it doesn't pass the D.I.M.S. test (Does It Make Sense). He >> wanted some confirmation before "flying off the handle". He said he had >> a couple of clients phone up saying MTS was threatening Linux users with >> disconnection unless they switched to an all M$ environment. I said I'd >> pass along the request and see what people say. >> >> My suspicion is MTS is saying the same thing to Linux users as they are >> saying to Windows 2000 users. Namely a) Direct connections will no >> longer be supported with the next generation of MTS software (older >> software may still work). b) Tech support will be cancelled for that >> particular operating system. c) Although the problem with connection >> will be fixed with a router, the router MUST be purchased from MTS for >> maximum compatibility. d) They will not sell their routers to people >> running unsupported operating systems. e) Install techs will not be >> trained or permitted to connect machines with unsupported operating systems. >> >> OTOH, it could be a hoax. Time will tell... >> >> Later >> Mike >> >> _______________________________________________ >> Roundtable mailing list >> Roundtable at muug.mb.ca >> http://www.muug.mb.ca/mailman/listinfo/roundtable > From robert at cluenet.org Tue Jul 13 14:40:07 2010 From: robert at cluenet.org (Robert Keizer) Date: Tue, 13 Jul 2010 14:40:07 -0500 Subject: [RndTbl] Request confirmation... In-Reply-To: <4C3CAB57.8070206@gmail.com> References: <4C3C9873.50000@gmail.com> <86E5EFA4-EA4D-4FBC-903E-98EEB0C16913@tinfoilhat.ca> <4C3CAB57.8070206@gmail.com> Message-ID: <4C3CC117.4070209@cluenet.org> On 10-07-13 01:07 PM, Mike Pfaiffer wrote: >> Note, LES.NET will provide DSL IP services using MTS' backhaul so that is an option for those DSL is the only option kind of situations. >> > Do you have any "literature" I can pass along to the CLL? There are > still a few people which can't get Shaw. This may be an alternative. > A side note: Les just got the signed CLEC letter. All the best, Robert Keizer From ve4drk at gmail.com Tue Jul 13 15:55:24 2010 From: ve4drk at gmail.com (Dan Keizer) Date: Tue, 13 Jul 2010 15:55:24 -0500 Subject: [RndTbl] Request confirmation... In-Reply-To: <4C3CC117.4070209@cluenet.org> References: <4C3C9873.50000@gmail.com> <86E5EFA4-EA4D-4FBC-903E-98EEB0C16913@tinfoilhat.ca> <4C3CAB57.8070206@gmail.com> <4C3CC117.4070209@cluenet.org> Message-ID: I used to be on MTS with their DSL, but went to les.net as he provides better options for what I would like -- and when I switched to les, my speed doubled and my RTT went in half -- obviously MTS didn't have things setup properly - I was even told from MTS at one point that the loop length may have been an issue -- but, obviously it was not. Good thing I switched as I now have a nice full-speed DSL line :-) I also have my VoIP hosted with les.net -- can't get better than that -- you can call .. but you can also get some information from the site http://les.net Dan. On Tue, Jul 13, 2010 at 2:40 PM, Robert Keizer wrote: > On 10-07-13 01:07 PM, Mike Pfaiffer wrote: >>> Note, LES.NET will provide DSL IP services using MTS' backhaul so that is an option for those DSL is the only option kind of situations. >>> >> ? ? ? Do you have any "literature" I can pass along to the CLL? There are >> still a few people which can't get Shaw. This may be an alternative. >> > > A side note: Les just got the signed CLEC letter. > > All the best, > Robert Keizer > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable > From athompso at athompso.net Tue Jul 13 23:32:36 2010 From: athompso at athompso.net (Adam Thompson) Date: Tue, 13 Jul 2010 23:32:36 -0500 Subject: [RndTbl] Request confirmation... In-Reply-To: References: <4C3C9873.50000@gmail.com> <86E5EFA4-EA4D-4FBC-903E-98EEB0C16913@tinfoilhat.ca> <4C3CAB57.8070206@gmail.com> <4C3CC117.4070209@cluenet.org> Message-ID: <006801cb230d$96127490$c2375db0$@net> Heh. "FEC" = Forward Error Correction. MTS uses it. They probably shouldn't in most cases, or rather: not so aggressively. For every 100 bits of user data your DSL modem transmits (or receives), it also sends anywhere between 1 and 50 bits of EDAC (error detection and correction) data. The particular schemes used in ADSL are collectively referred to as FEC, and typically convolutional Trellis Coding is combined with Reed-Solomon block coding. The The DSL Forum Technical Report TR-63 (addendum to TR-57) clarifies that in general DSL management systems may specify - independently - upstream and downstream FEC overhead between 1% and 50%. I don't recall where MTS has it set usually, but I do recall that it's substantial. And on slower connections (e.g. the <1Mbps upstream connection) adding that much overhead *can* introduce noticeable latency. In theory, it shouldn't be double, but implementation details can alter that assumption. The reason FEC is used is the same reason ARQ was added to modems back in the 2400baud days - phone lines are "noisy". We aren't talking Cat6 cable here, we aren't even talking Cat3, which is generally what gets run inside a building for telephone use. We're talking a single pair of copper wires, often with no twist whatsoever, sometimes both in direct contact with the ground (which does *not* provide infinite electrical resistance, i.e. it's a partial short), sometimes with "load coils" (don't ask if you don't already know!)... basically a worst-case scenario for data transmission. Without FEC, so many packets would be discarded that your DSL line would be completely useless. Ever try to download a file when you're getting 10% packet loss? Try it at 90% packet loss. Good luck :-). So the bottom line is, MTS errs on the side of reliability over performance. HOWEVER: the FEC parameters are tunable on a per-modem basis, and the upstream and downstream knobs are independent. Does MTS implement this? I know they sure didn't the last time I had anything to do with their OA&M systems (about 6 years ago). The telco (ILEC, but not MTS) I do work with now certainly doesn't - because management systems that can tune those knobs intelligently and automatically are !#@$%^&* expensive, and it's just too much work to do manually. If Les has convinced MTS to reduce the FEC overhead, you'll get a speed improvement of UP TO 50%, and a latency decrease of UP TO 50%. (Anything beyond 50% indicates non-standard implementation.) On the other hand, if Les didn't actually ask for that, I have to wonder if MTS is turning FEC back down to the minimum in order to make Les' service appear less reliable??? Considering some of the anti-competitive behaviour they exhibit (not quite illegal, though) it wouldn't surprise me. FWIW, previous generations of ADSL equipment typically had FEC as an on/off switch, not a controllable parameter. And Sean and I probably share the same information sources inside MTS, from several years ago... And since I don't work there anymore, and I don't know the details of their DSLAMs, anything I've said here might be inapplicable or just plain wrong. -Adam -----Original Message----- From: roundtable-bounces at muug.mb.ca [mailto:roundtable-bounces at muug.mb.ca] On Behalf Of Dan Keizer Sent: Tuesday, July 13, 2010 15:55 To: Continuation of Round Table discussion Subject: Re: [RndTbl] Request confirmation... I used to be on MTS with their DSL, but went to les.net as he provides better options for what I would like -- and when I switched to les, my speed doubled and my RTT went in half -- obviously MTS didn't have things setup properly - I was even told from MTS at one point that the loop length may have been an issue -- but, obviously it was not. Good thing I switched as I now have a nice full-speed DSL line :-) I also have my VoIP hosted with les.net -- can't get better than that -- you can call .. but you can also get some information from the site http://les.net Dan. From rayhenry at autoclubs.ca Wed Jul 14 06:40:47 2010 From: rayhenry at autoclubs.ca (Raymond J. Henry) Date: Wed, 14 Jul 2010 06:40:47 -0500 Subject: [RndTbl] Request confirmation... In-Reply-To: References: <4C3C9873.50000@gmail.com> <86E5EFA4-EA4D-4FBC-903E-98EEB0C16913@tinfoilhat.ca> <4C3CAB57.8070206@gmail.com> <4C3CC117.4070209@cluenet.org> Message-ID: <002301cb2349$66aab780$34002680$@ca> The response from my contact within MTS: "Haven't heard a thing like that. Misinterpreted information from talking to a first-level tech, I'd guess. Next-gen stuff should work with linux easy; it's DHCP on the Ultimate TV side." From john at johnlange.ca Wed Jul 21 10:30:20 2010 From: john at johnlange.ca (John Lange) Date: Wed, 21 Jul 2010 10:30:20 -0500 Subject: [RndTbl] mount by label, a cautionary tail Message-ID: <1279726220.3840.116.camel@linux-k6vx.site> I was migrating some data to some new disks and since the drive letters would be changing once the old disks were removed, I partitioned them and gave them label names. The original disks had labels like: boot srv tmp On the new disk I thought good names would be: /boot /srv /tmp (I think Redhat actually names things this way by default?) Anyhow, to make a long story short, mount by label ignores the leading slash. When the system rebooted, as predicted the drives came up in a different order so a "mount LABEL=srv" will actually mount the first disk named either "/srv" or "srv" which is obviously not good. I don't know if this is just a bug or intentional. -- John Lange http://www.johnlange.ca From athompso at athompso.net Sat Jul 31 18:18:47 2010 From: athompso at athompso.net (Adam Thompson) Date: Sat, 31 Jul 2010 18:18:47 -0500 Subject: [RndTbl] another shell thing I've forgotten... Message-ID: <003101cb3106$ba86c3b0$2f944b10$@athompso.net> Inside a shell script, I want to start a persistent mysql client process and feed it commands one by one. I?d like to use a named pipe, but the only way I?ve found to do it so far is with a subshell, by putting 99% of the script inside the subshell and piping the subsell?s entire output to mysql. While this more-or-less works, it?s very much not ideal. If I use a named pipe, every time I echo something to that pipe (e.g. ?echo INSERT INTO? > /tmp/mypipe?), mysql immediately exits upon reaching EOF, so only the very first command gets executed. I recall posting a way to accomplish this with psql & inetd a year or two ago, but I don?t want to use inetd ? this *must* be entirely self-contained within a single shell script. Also I can?t figure out a way to tell mysql to ignore EOF on STDIN and to immediately reopen it. Anyone have any better ideas? Thanks, -Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.muug.mb.ca/pipermail/roundtable/attachments/20100731/c832a71b/attachment.html From sean at ertw.com Sat Jul 31 20:45:28 2010 From: sean at ertw.com (Sean Walberg) Date: Sat, 31 Jul 2010 20:45:28 -0500 Subject: [RndTbl] another shell thing I've forgotten... In-Reply-To: <003101cb3106$ba86c3b0$2f944b10$@athompso.net> References: <003101cb3106$ba86c3b0$2f944b10$@athompso.net> Message-ID: There's discussion of it at http://www.linuxjournal.com/article/2156, including a work around: sleep 9999999 > pipe & You could probably come up with something more clever than that, but the general idea seems to be that the pipe closes when all the writers are done, this keeps it open. I'd imagine a simple C program to fork off, open the file, and then while(1) { sleep(99999);} would be good enough. Sean On Sat, Jul 31, 2010 at 6:18 PM, Adam Thompson wrote: > Inside a shell script, I want to start a persistent mysql client process > and feed it commands one by one. > > I?d like to use a named pipe, but the only way I?ve found to do it so far > is with a subshell, by putting 99% of the script inside the subshell and > piping the subsell?s entire output to mysql. While this more-or-less works, > it?s very much not ideal. > > If I use a named pipe, every time I echo something to that pipe (e.g. ?echo > INSERT INTO? > /tmp/mypipe?), mysql immediately exits upon reaching EOF, so > only the very first command gets executed. > > I recall posting a way to accomplish this with psql & inetd a year or two > ago, but I don?t want to use inetd ? this **must** be entirely > self-contained within a single shell script. Also I can?t figure out a way > to tell mysql to ignore EOF on STDIN and to immediately reopen it. > > > > Anyone have any better ideas? > > > > Thanks, > > -Adam > > > > _______________________________________________ > Roundtable mailing list > Roundtable at muug.mb.ca > http://www.muug.mb.ca/mailman/listinfo/roundtable > > -- Sean Walberg http://ertw.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.muug.mb.ca/pipermail/roundtable/attachments/20100731/74bf4906/attachment.html