Re: script help
Bob Alexander wrote: I keep a few different kernel source trees under /usr/src and each of them has a different .config file. Part of my pre-backup script I would like to run a command such as find /usr/src -name .config for example: /usr/src/kernel-source-2.6.9-rja/.config /usr/src/linux-2.6.10-rja/.config and for every match write a file to my /backup_data directory with a filename that is made up like kernel-source-2.6.9-rja.config and linux-2.6.10-rja.config or some similar unique filename which relates the the kernel tree. Thank you for any help, Bob (using bash:) for i in * do if [ -d $i ] then if [ -f $i/.config ] then echo cp $i/.config /backup_data/$i.config fi fi done If this prints the correct lines, remove echo in front of the cp and run again ;) HTH, Joris -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: script help
On Wed, 29 Dec 2004 15:26:17 +0100, Bob Alexander [EMAIL PROTECTED] wrote: I keep a few different kernel source trees under /usr/src and each of them has a different .config file. Part of my pre-backup script I would like to run a command such as find /usr/src -name .config for example: /usr/src/kernel-source-2.6.9-rja/.config /usr/src/linux-2.6.10-rja/.config and for every match write a file to my /backup_data directory with a filename that is made up like kernel-source-2.6.9-rja.config and linux-2.6.10-rja.config or some similar unique filename which relates the the kernel tree. With 'find' you can -exec on each result. For example (note the trailing \; is required to end the exec string. find will execute all commands until that is found.): find /usr/src -name .config -exec cp {} /backup_data{} \; {} will be expanded to the entire path of the found file. The above line won't work because cp won't create the entire path /backup_data/usr/src/kernel-source-2.6.9-rja/.config :) You might want to process {} to create a proper destination. Hope that Helps! -- Darryl [EMAIL PROTECTED] http://smartssa.com / http://darrylclarke.com -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: Script help
On Sunday 07 September 2003 1:10 am, Dave Carrigan wrote: On Sat, Sep 06, 2003 at 10:03:09PM -0400, Jeff Elkins wrote: I'm doing a lot of work with a Sharp Zaurus which requires several re-flashes of the box daily - With my initrd.bin, ssh keys on the Z regenerate with each flash. As a consequence, my host .ssh/known_hosts is frequently outdated and I must edit it to remove references to z,xxx.xxx.xxx.xxx. I'd like to gen up a script to nuke references in .ssh/known_hosts to the Zaurus. It's trivial to edit known_hosts, but I'd like to eliminate this step. perl -ni.bak -e 'print unless /^z,xxx.xxx.xxx.xxx/' ~/.ssh/known_hosts Thanks, Karsten and Dave. Jeff -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: Script help
on Sat, Sep 06, 2003 at 10:03:09PM -0400, Jeff Elkins ([EMAIL PROTECTED]) wrote: I'm doing a lot of work with a Sharp Zaurus which requires several re-flashes of the box daily - With my initrd.bin, ssh keys on the Z regenerate with each flash. As a consequence, my host .ssh/known_hosts is frequently outdated and I must edit it to remove references to z,xxx.xxx.xxx.xxx. I'd like to gen up a script to nuke references in .ssh/known_hosts to the Zaurus. It's trivial to edit known_hosts, but I'd like to eliminate this step. Can someone point me in the right direction? sed -e '/pattern/d' ~/.ssh/known_hosts ~/.ssh/known_hosts.tmp mv ~/.ssh/known_hosts.tmp ~/.ssh/known_hosts If you have known good state of known_hosts that you want to restore, just copy it in from a template at startup or login. Peace. -- Karsten M. Self [EMAIL PROTECTED]http://kmself.home.netcom.com/ What Part of Gestalt don't you understand? Defeat EU Software Patents! http://swpat.ffii.org/ pgp0.pgp Description: PGP signature
Re: Script help
On Sat, Sep 06, 2003 at 10:03:09PM -0400, Jeff Elkins wrote: I'm doing a lot of work with a Sharp Zaurus which requires several re-flashes of the box daily - With my initrd.bin, ssh keys on the Z regenerate with each flash. As a consequence, my host .ssh/known_hosts is frequently outdated and I must edit it to remove references to z,xxx.xxx.xxx.xxx. I'd like to gen up a script to nuke references in .ssh/known_hosts to the Zaurus. It's trivial to edit known_hosts, but I'd like to eliminate this step. perl -ni.bak -e 'print unless /^z,xxx.xxx.xxx.xxx/' ~/.ssh/known_hosts -- Dave Carrigan Seattle, WA, USA [EMAIL PROTECTED] | http://www.rudedog.org/ | ICQ:161669680 UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL pgp0.pgp Description: PGP signature
Re: script help
man find erik Chris Mason wrote: I need to come up with a bash shell script that deletes all the files in a folder older than N days. I'm not sure how to test for file age so I can't get it done myself, can someone suggest a way? Chris Mason Box 340, The Valley, Anguilla, British West Indies Tel: 264 497 5670 Fax: 264 497 8463 USA Fax (561) 382-7771 Take a virtual tour of the island http://net.ai/ The Anguilla Guide Find out more about NetConcepts www.netconcepts.ai Talk to me in real time with Instant Messenger: [EMAIL PROTECTED] -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] /dev/null
Re: script help
Chris Mason [EMAIL PROTECTED] writes: I need to come up with a bash shell script that deletes all the files in a folder older than N days. I'm not sure how to test for file age so I can't get it done myself, can someone suggest a way? use find(1) with the mtime flag, e.g. find /tmp -type f -mtime +30 -exec rm {} \; will remove all files in /tmp that are more than 30 days old. -- Mike Quin Unix Systems Support Systems and Networks Group, University of Stirling Clue. You've either got it, or you work for UUnet - seen on UKMM
Re: Script help...............
On Mon, 26 Oct 1998, Phillip Neumann wrote: Hi debian world... Im not know very much about scripts so i need some help with one.. Here my situation: A script will be executed when i call to my linux box... here it is: /etc/init.d/xringd stop /root/IP_MAIL pon incomingcall /etc/init.d/xringd start| | | This has the -detach option so i can kill it and the script will continue... Now, i have problems with /root/IP_MAIL, becouse it try to send me my ip number before i can get one... this is how IP_mail looks: 1)DAY=$(date +%A) 2)NUMBER=$(date +%d) 3)TIME=$(date +%r) 4)MONTH=$(date +%m) 5)IP=$(/sbin/ifconfig | grep inet | awk '{print $2}' |awk -F: '{print $2}' | grep -v 127) 6)echo Today, $DAY $NUMBER/$MONTH [$TIME] you have got an ip address: $IP /tmp/iptemporal.tmp 7)mail -s Identidad: $IP [EMAIL PROTECTED] /tmp/iptemporal.tmp in [EMAIL PROTECTED] i get: Today, Monday 26/10 [07:45:12 PM] you have got an ip address: so how can i make IP_MAIL do 1,2,3,4 and 5 until $IP is not empty ?? (is $IP is not empty then go on and send the mail...) Hmmm, What you need, is a script in /etc/ppp/ip-up.d/ to do this, but only when 'pon incomingcall' is executed.. change your first script thus: /etc/init.d/xringd stop touch /tmp/make_IP_available pon incomingcall rm /tmp/make_IP_available /etc/init.d/xringd start place your second script in /etc/ppp/ip-up.d/ and start it with: #!/bin/sh test -f /tmp/make_IP_available || exit 0 ... so if the first script was called, it creates a temporary 0 byte file, that the second script checks for. If it exists, it mails you with the IP Address. Michael Beattie ([EMAIL PROTECTED]) PGP Key available, reply with pgpkey as subject. - Bother, said Pooh, as the rip cord came away in his hand - Debian GNU/Linux Ooohh You are missing out!
RE: Script help...............
Dunno why you are doing it this way so let me ask. Why are you not using the scripts in /etc/ppp/ip-{up,down}?? The IP address of the connection is passed to the scripts on login. So you are guaranteed to get a good IP. If this is not useful for some reason contact me and I can get your script working. On 26-Oct-98 Phillip Neumann wrote: Hi debian world... Im not know very much about scripts so i need some help with one.. Here my situation: A script will be executed when i call to my linux box... here it is: /etc/init.d/xringd stop /root/IP_MAIL pon incomingcall /etc/init.d/xringd start| | | This has the -detach option so i can kill it and the script will continue... Now, i have problems with /root/IP_MAIL, becouse it try to send me my ip number before i can get one... this is how IP_mail looks: 1)DAY=$(date +%A) 2)NUMBER=$(date +%d) 3)TIME=$(date +%r) 4)MONTH=$(date +%m) 5)IP=$(/sbin/ifconfig | grep inet | awk '{print $2}' |awk -F: '{print $2}' | grep -v 127) 6)echo Today, $DAY $NUMBER/$MONTH [$TIME] you have got an ip address: $IP /tmp/iptemporal.tmp 7)mail -s Identidad: $IP [EMAIL PROTECTED] /tmp/iptemporal.tmp in [EMAIL PROTECTED] i get: Today, Monday 26/10 [07:45:12 PM] you have got an ip address: so how can i make IP_MAIL do 1,2,3,4 and 5 until $IP is not empty ?? (is $IP is not empty then go on and send the mail...) Thanks, Phillip Neumann [EMAIL PROTECTED] -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] /dev/null -- E-Mail: Shaleh [EMAIL PROTECTED] Date: 26-Oct-98 Time: 23:21:09 This message was sent by XFMail --
Re: Script help...............
Michael Beattie wrote: On Mon, 26 Oct 1998, Phillip Neumann wrote: Hi debian world... Im not know very much about scripts so i need some help with one.. Here my situation: A script will be executed when i call to my linux box... here it is: /etc/init.d/xringd stop /root/IP_MAIL pon incomingcall /etc/init.d/xringd start| | | This has the -detach option so i can kill it and the script will continue... Now, i have problems with /root/IP_MAIL, becouse it try to send me my ip number before i can get one... this is how IP_mail looks: 1)DAY=$(date +%A) 2)NUMBER=$(date +%d) 3)TIME=$(date +%r) 4)MONTH=$(date +%m) 5)IP=$(/sbin/ifconfig | grep inet | awk '{print $2}' |awk -F: '{print $2}' | grep -v 127) 6)echo Today, $DAY $NUMBER/$MONTH [$TIME] you have got an ip address: $IP /tmp/iptemporal.tmp 7)mail -s Identidad: $IP [EMAIL PROTECTED] /tmp/iptemporal.tmp in [EMAIL PROTECTED] i get: Today, Monday 26/10 [07:45:12 PM] you have got an ip address: so how can i make IP_MAIL do 1,2,3,4 and 5 until $IP is not empty ?? (is $IP is not empty then go on and send the mail...) Hmmm, What you need, is a script in /etc/ppp/ip-up.d/ to do this, but only when 'pon incomingcall' is executed.. change your first script thus: /etc/init.d/xringd stop touch /tmp/make_IP_available pon incomingcall rm /tmp/make_IP_available /etc/init.d/xringd start place your second script in /etc/ppp/ip-up.d/ and start it with: #!/bin/sh test -f /tmp/make_IP_available || exit 0 ... so if the first script was called, it creates a temporary 0 byte file, that the second script checks for. If it exists, it mails you with the IP Address. Michael Beattie ([EMAIL PROTECTED]) PGP Key available, reply with pgpkey as subject. - Bother, said Pooh, as the rip cord came away in his hand - Debian GNU/Linux Ooohh You are missing out! Hello Well thanks, i finnaly got this working 8-] bye, -- __ / / / Phillip Neumann / / [EMAIL PROTECTED] / _/_/
Re: Script help
kill -l for a list of the names attached to the numbers man 7 signal for a more exhaustive explanation. On 10 Jun 97, Andy J. Smith wrote regarding: __ Re: Script help __ On Mon, 9 Jun 1997, J. Paul Reed wrote: [different types of signals] Do you know what -1 to -?? does? I've always wondered, since I've only ever used -9 and -15. There's a man page that lists them all. signals I think it is called, but if not, a man -k signal would probably show it. Gerald V. Livingston II Reply to [EMAIL PROTECTED] -- TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to [EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED] .