Re: [CentOS] Shell Script Help

2013-09-06 Thread Nicolas Thierry-Mieg
Matt wrote: I have a script file in my cron.hourly that contains a good number of scripts I must call. #!/bin/sh sleep 15 perl /scripts/create_graph.pl sleep 15 perl /scripts/create_graph_out.pl many more lines. etc. Is there a way I can sleep random length to time before executing

Re: [CentOS] Shell Script Help

2013-09-06 Thread Marc Wiatrowski
On Fri, Sep 6, 2013 at 8:44 AM, Nicolas Thierry-Mieg nicolas.thierry-m...@imag.fr wrote: Matt wrote: I have a script file in my cron.hourly that contains a good number of scripts I must call. #!/bin/sh sleep 15 perl /scripts/create_graph.pl sleep 15 perl

[CentOS] Shell Script Help

2013-09-05 Thread Matt
I have a script file in my cron.hourly that contains a good number of scripts I must call. #!/bin/sh sleep 15 perl /scripts/create_graph.pl sleep 15 perl /scripts/create_graph_out.pl many more lines. etc. Is there a way I can sleep random length to time before executing each but background

Re: [CentOS] Shell Script Help

2013-09-05 Thread Stephen Harris
On Thu, Sep 05, 2013 at 10:24:55AM -0500, Matt wrote: I have a script file in my cron.hourly that contains a good number of scripts I must call. #!/bin/sh sleep 15 perl /scripts/create_graph.pl sleep 15 perl /scripts/create_graph_out.pl many more lines. etc. Don't background

Re: [CentOS] Shell Script Help

2013-09-05 Thread Tony Sweeney
LIMIT=10 # Or whatever sleep `expr $RANDOM % $LIMIT + 1` -Original Message- From: centos-boun...@centos.org [mailto:centos-boun...@centos.org] On Behalf Of Matt Sent: 05 September 2013 16:25 To: CentOS mailing list Subject: [CentOS] Shell Script Help I have a script file in my

Re: [CentOS] Shell Script Help

2013-09-05 Thread Mark LaPierre
On 09/05/2013 11:24 AM, Matt wrote: I have a script file in my cron.hourly that contains a good number of scripts I must call. #!/bin/sh sleep 15 perl /scripts/create_graph.pl sleep 15 perl /scripts/create_graph_out.pl many more lines. etc. Is there a way I can sleep random

[CentOS] Shell Script: Simple array usage = bad substitution?

2009-06-19 Thread James Bensley
Hey Guys n Gals; I have some arrays that I can't seem to expand correctly (if that's the correct word?), imagine the following example: #!/bin/bash myArray=(First Second Third) First=(Monday Tuesdays Wednesday) Second=(One Two Three) Third=(A B C) for ((i=0;i${#myarr...@]};i++)) do for

Re: [CentOS] Shell Script: Simple array usage = bad substitution?

2009-06-19 Thread Bob Beers
On Fri, Jun 19, 2009 at 8:43 AM, James Bensley jwbens...@gmail.com wrote: Hey Guys n Gals; I have some arrays that I can't seem to expand correctly (if that's the correct word?), imagine the following example: #!/bin/bash myArray=(First Second Third) First=(Monday Tuesdays Wednesday)

Re: [CentOS] Shell Script Pointers?

2009-05-19 Thread Eric Sisolak
On Thu, May 14, 2009 at 1:31 AM, James Bensley jwbens...@gmail.com wrote: if you're already going to the effort of downloading the entire blacklist every night, why not dump the old database, and just insert the newly downloaded one? Because we also add our own entries to the current

Re: [CentOS] Shell Script Pointers?

2009-05-19 Thread Stuart Jansen
On Tue, 2009-05-19 at 22:06 -0400, Eric Sisolak wrote: Also you could try for FOLDER in `find /usr/local/squidGuard/db -maxdepth 1 -type d`; do This is a classic mistake. It has two problems: 1) The list of files created by the embedded find can exceed the maximum command length. 2)

Re: [CentOS] Shell Script Pointers?

2009-05-14 Thread James Bensley
I have written my script but I wanted to add this on before and after the update to see the difference but all it returns are zeros? Anyone have any idea why? #!/bin/sh f=0 #Folder count d=0 #Domains count (one per line in each file) u=0 #Url count (one per line in each file) t=0 #Total of

Re: [CentOS] Shell Script Pointers?

2009-05-14 Thread James Bensley
Update: these lines should be: + $X                d=`expr $d + 1` and snip                u=`expr $u + 1`        fi done James ;) -BEGIN GEEK CODE BLOCK- Version: 3.1 GIT/MU/U dpu s: a-- C++$ U+ L++ B- P+ E? W+++$ N K W++ O M++$ V- PS+++ PE++ Y+ PGP t 5 X+ R- tv+ b+ DI D+++

Re: [CentOS] Shell Script Pointers?

2009-05-14 Thread Spiro Harvey
On Thu, 14 May 2009 12:35:13 +0100 James Bensley jwbens...@gmail.com wrote: Update: these lines should be: + $X that should be lower case. My guess is that because your variables all equal zero, it's possible that something is wrong with: find /usr/local/squidGuard/db -maxdepth 1 -type d |

Re: [CentOS] Shell Script Pointers?

2009-05-14 Thread Stephen Harris
On Fri, May 15, 2009 at 10:17:21AM +1200, Spiro Harvey wrote: My guess is that because your variables all equal zero, it's possible that something is wrong with: find /usr/local/squidGuard/db -maxdepth 1 -type d | while read FOLDER; More likely he's using a shell that runs the while loop in

[CentOS] Shell Script Pointers?

2009-05-13 Thread James Bensley
Hey Listee's I am trying to write a shell script to sort and compare my blacklist for squidGuard with the nightly updates that come down in a tar ball. It should be rather simple but I'm not to grate at this. The script is to run nightly, it will download the latest blacklist tarball, un tar it

Re: [CentOS] Shell Script Pointers?

2009-05-13 Thread Spiro Harvey
to run nightly, it will download the latest blacklist tarball, un tar it and then add any new entries to the existing black list. The if you're already going to the effort of downloading the entire blacklist every night, why not dump the old database, and just insert the newly downloaded one?

Re: [CentOS] Shell Script Pointers?

2009-05-13 Thread James Bensley
if you're already going to the effort of downloading the entire blacklist every night, why not dump the old database, and just insert the newly downloaded one? Because we also add our own entries to the current blacklist so we are just adding any new entries from the nightly updates of our

[CentOS] shell script

2009-02-08 Thread Mad Unix
I have to run multiple command about 20x on linux each one got his own output, I want to bind all the out puts of them in one file then read this file and mail it to user account sample [r...@imail pons]# /home/pons/tsmmonitor stgpool SDC-STAFF stgpool - utilization of storage pool SDC-STAFF

Re: [CentOS] shell script

2009-02-08 Thread Filipe Brandenburger
Hi Mad Unix, On Sun, Feb 8, 2009 at 09:06, Mad Unix madu...@gmail.com wrote: I have to run multiple command about 20x on linux each one got his own output, It is not the first time you come to the list with questions about shell scripting, and most of them very basic. So, what I really

Re: [CentOS] shell script

2009-02-08 Thread Mad Unix
resolved. On Sun, Feb 8, 2009 at 4:33 PM, Filipe Brandenburger filbran...@gmail.com wrote: Hi Mad Unix, On Sun, Feb 8, 2009 at 09:06, Mad Unix madu...@gmail.com wrote: I have to run multiple command about 20x on linux each one got his own output, It is not the first time you come to the

Re: [CentOS] shell script

2009-02-08 Thread Chris Geldenhuis
Mad Unix wrote: I have to run multiple command about 20x on linux each one got his own output, I want to bind all the out puts of them in one file then read this file and mail it to user account sample [r...@imail pons]# /home/pons/tsmmonitor stgpool SDC-STAFF stgpool - utilization of

Re: [CentOS] shell script

2009-02-08 Thread Matt Shields
On Sun, Feb 8, 2009 at 9:52 AM, Chris Geldenhuis chris.gel...@iafrica.comwrote: Mad Unix wrote: I have to run multiple command about 20x on linux each one got his own output, I want to bind all the out puts of them in one file then read this file and mail it to user account sample

Re: [CentOS] shell script

2009-02-08 Thread Chris Geldenhuis
Matt Shields wrote: On Sun, Feb 8, 2009 at 9:52 AM, Chris Geldenhuis chris.gel...@iafrica.com mailto:chris.gel...@iafrica.com wrote: Mad Unix wrote: I have to run multiple command about 20x on linux each one got his own output, I want to bind all the out puts of them in one

Re: [CentOS] shell script

2009-02-08 Thread Kai Schaetzl
You want this and I want a grapefruit. Thanks for you attitude. Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com ___ CentOS mailing list CentOS@centos.org

Re: [CentOS] shell script

2009-02-08 Thread Matt Shields
On Sun, Feb 8, 2009 at 10:02 AM, Chris Geldenhuis chris.gel...@iafrica.comwrote: Matt Shields wrote: On Sun, Feb 8, 2009 at 9:52 AM, Chris Geldenhuis chris.gel...@iafrica.com mailto:chris.gel...@iafrica.com wrote: Mad Unix wrote: I have to run multiple command about 20x on

[CentOS] Shell Script - Compare packages. rpm.

2009-01-26 Thread Tiago Dias
Hi, I need a script which makes the package compação rpm's through two text files ... Since a file is the output of the command *rpm-qa pkg.out * And the second file is a list of several packages rpm's, multiple versions and architectures. My idea is to

Re: [CentOS] Shell Script - Compare packages. rpm.

2009-01-26 Thread Ian Forde
On Mon, 2009-01-26 at 08:26 -0200, Tiago Dias wrote: Hi, I need a script which makes the package compação rpm's through two text files ... Since a file is the output of the command rpm-qa pkg.out And the second file is a list of several packages rpm's,

Re: [CentOS] Shell Script - Compare packages. rpm.

2009-01-26 Thread John Doe
From: Tiago Dias tux.ti...@gmail.com I need a script which makes the package compação rpm's through two text files ... Since a file is the output of the command rpm-qa pkg.out And the second file is a list of several packages rpm's, multiple versions and architectures. Just for the

Re: [CentOS] Shell script to list group members

2008-09-24 Thread Ian Blackwell
Bob Beers wrote: grep group_name: /etc/group | cut -d: -f4 will give a comma separated list, provided group_name is a valid group name. There is one problem with this approach, which is the assumption that all users' primary group is the same as their login id - which I agree is typically

Re: [CentOS] Shell script to list group members

2008-09-24 Thread Bob Beers
Part 1: On Tue, Sep 23, 2008 at 7:37 PM, Ian Blackwell [EMAIL PROTECTED] wrote: Bob Beers wrote: grep group_name: /etc/group | cut -d: -f4 will give a comma separated list, provided group_name is a valid group name. There is one problem with this approach, which is the assumption that

Re: [CentOS] Shell script to list group members

2008-09-24 Thread Ian Blackwell
Bob Beers wrote: Part 1: You have a valid point, but the OP's question was: I am looking for a (simple) shell command to run from a bash script that will allow me to list user accounts that belong to a particular group. In all likelihood the system follows the default approach of

[CentOS] Shell script to list group members

2008-09-23 Thread Tim Alberts
I have several shell scripts to manage user accounts on a server. I've been using a file with the usernames of peoples accounts that any script needs to process. I had a thought that I can and should be setting up groups and adding user accounts to those groups so I don't have to maintain a

Re: [CentOS] Shell script to list group members

2008-09-23 Thread Barry Brimer
Quoting Tim Alberts [EMAIL PROTECTED]: I have several shell scripts to manage user accounts on a server. I've been using a file with the usernames of peoples accounts that any script needs to process. I had a thought that I can and should be setting up groups and adding user accounts to

Re: [CentOS] Shell script to list group members

2008-09-23 Thread Bob Beers
On Tue, Sep 23, 2008 at 1:31 PM, Tim Alberts [EMAIL PROTECTED] wrote: So essentially, I am looking for a (simple) shell command to run from a bash script that will allow me to list user accounts that belong to a particular group. Any help is appreciated. grep group_name: /etc/group | cut -d:

Re: [CentOS] Shell script to list group members

2008-09-23 Thread Tim Alberts
Barry Brimer wrote: With spaces separating groups: egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/ /g' With commas separating groups: egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' I'm sorry, I didn't specify, I'm using LDAP for user/group management.

Re: [CentOS] Shell script to list group members

2008-09-23 Thread Bob Beers
On Tue, Sep 23, 2008 at 7:11 PM, Tim Alberts [EMAIL PROTECTED] wrote: Barry Brimer wrote: With spaces separating groups: egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/ /g' With commas separating groups: egrep -e '^groupname:' /etc/group | awk -F : '{ print $4

Re: [CentOS] Shell script to list group members

2008-09-23 Thread Barry Brimer
Quoting Tim Alberts [EMAIL PROTECTED]: Barry Brimer wrote: With spaces separating groups: egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/ /g' With commas separating groups: egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' I'm sorry, I didn't

Re: [CentOS] Shell script to list group members

2008-09-23 Thread Bob Beers
On Tue, Sep 23, 2008 at 7:26 PM, Barry Brimer [EMAIL PROTECTED] wrote: Quoting Tim Alberts [EMAIL PROTECTED]: Barry Brimer wrote: With spaces separating groups: egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/ /g' With commas separating groups: egrep -e

Re: [CentOS] Shell script to list group members

2008-09-23 Thread Tim Alberts
Bob Beers wrote: On Tue, Sep 23, 2008 at 7:26 PM, Barry Brimer [EMAIL PROTECTED] wrote: With commas separating groups: getent group | egrep -i '^groupname:' | awk -F : '{ print $4}' With spaces separating groups: getent group | egrep -i '^groupname:' | awk -F : '{ print $4}' | sed -e

Re: [CentOS] Shell script to list group members

2008-09-23 Thread Barry Brimer
On Tue, 23 Sep 2008, Bob Beers wrote: On Tue, Sep 23, 2008 at 7:26 PM, Barry Brimer [EMAIL PROTECTED] wrote: Quoting Tim Alberts [EMAIL PROTECTED]: Barry Brimer wrote: With spaces separating groups: egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/ /g' With

Re: [CentOS] Shell script to list group members

2008-09-23 Thread MHR
On Tue, Sep 23, 2008 at 6:43 PM, Barry Brimer [EMAIL PROTECTED] wrote: The egrep is using a leading anchor (^) to make sure the grep matches the beginning of the line. If not, and the group pattern matched as one of the users it would print those lines too .. which is probably undesirable.

[CentOS] Shell script - ping

2008-07-28 Thread Gopinath Achari
hi, how to write a scripts which launches 10 pings to different destinations at execution of single shell scripts please help me any ideas regards, Gopinath ___ CentOS mailing list CentOS@centos.org

Re: [CentOS] Shell script - ping

2008-07-28 Thread Laurence Alexander Hurst
Gopinath Achari wrote: hi, how to write a scripts which launches 10 pings to different destinations at execution of single shell scripts please help me any ideas regards, Gopinath Do you mean something like: ping -c10 host1 ping -c10 host2 which will ping host1 10 times,

Re: [CentOS] Shell script - ping

2008-07-28 Thread Javor Nikolov
Hi, If you you want a quicker execution - you could also run the pings to separate hosts in parallel starting the jobs in background () and waiting for them with wait after that. You'll have to be more careful about the outputs in that case - e.g. redirect them to separate files. Regards, Javor

Re: [CentOS] Shell script - ping

2008-07-28 Thread Bill Campbell
On Mon, Jul 28, 2008, Gopinath Achari wrote: hi, how to write a scripts which launches 10 pings to different destinations at execution of single shell scripts please help me any ideas If your goal is to test connectivity, you might look at the perl Net::Ping module. ``perldoc

Re: [CentOS] Shell script - ping

2008-07-28 Thread Lorenzo Martínez Rodríguez
Bill Campbell escribió: On Mon, Jul 28, 2008, Gopinath Achari wrote: hi, how to write a scripts which launches 10 pings to different destinations at execution of single shell scripts please help me any ideas If your goal is to test connectivity, you might look at the

Re: [CentOS] Shell script - ping

2008-07-28 Thread Gopinath Achari
thank u all On Mon, 2008-07-28 at 16:11 +0300, Javor Nikolov wrote: Hi, If you you want a quicker execution - you could also run the pings to separate hosts in parallel starting the jobs in background () and waiting for them with wait after that. You'll have to be more careful about the

[CentOS] Shell Script Question

2008-07-09 Thread Joseph L. Casale
What's the simplest way to increment the number up by one until some other 4 digit number while preserving leading zero's until the 1000's has a digit other than 0? Thanks! jlc ___ CentOS mailing list CentOS@centos.org

Re: [CentOS] Shell Script Question

2008-07-09 Thread Steve Thompson
On Wed, 9 Jul 2008, Joseph L. Casale wrote: What's the simplest way to increment the number up by one until some other 4 digit number while preserving leading zero's until the 1000's has a digit other than 0? In zsh, it would be something like: for i in {..}; do echo $i

Re: [CentOS] Shell Script Question

2008-07-09 Thread Stephen John Smoogen
On Wed, Jul 9, 2008 at 6:22 PM, Joseph L. Casale [EMAIL PROTECTED] wrote: What's the simplest way to increment the number up by one until some other 4 digit number while preserving leading zero's until the 1000's has a digit other than 0? Your homework done in a snap! for (i=0;

RE: [CentOS] Shell Script Question

2008-07-09 Thread Joseph L. Casale
Your homework done in a snap! Lol, nah, not homework :P I don't know what I was thinking, long day. OTH, I never seq could do this as well! Thanks! jlc ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos

Re: [CentOS] Shell Script Question

2008-07-09 Thread Stephen Harris
What's the simplest way to increment the number up by one until some other 4 digit number while preserving leading zero's until the 1000's has a digit other than 0? Lots of answers, depending on the shell. I like this version for ksh: typeset -Z4 a=-1 while (( a++ 1000 )) do

Re: [CentOS] Shell Script Question

2008-07-09 Thread Les Bell
Joseph L. Casale [EMAIL PROTECTED] wrote: What's the simplest way to increment the number up by one until some other 4 digit number while preserving leading zero's until the 1000's has a digit other than 0? Easy: $ seq -f %04g Best, --- Les Bell, RHCE, CISSP

Re: [CentOS] shell script strangeness...

2008-05-16 Thread Ian Blackwell
Craig White wrote: That works fine one CentOS 5 (double quotes and backtics) but not on CentOS 4.6 Thanks...I guess it's good enough for now. Craig ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos I can

Re: [CentOS] shell script strangeness...

2008-05-16 Thread Craig White
On Fri, 2008-05-16 at 17:03 +0930, Ian Blackwell wrote: Craig White wrote: That works fine one CentOS 5 (double quotes and backtics) but not on CentOS 4.6 Thanks...I guess it's good enough for now. Craig ___ CentOS mailing list

[CentOS] shell script strangeness...

2008-05-15 Thread Craig White
On my CentOS 4.6 server, this works... if [ -z `grep entry_chooser.js /var/log/httpd/access_log` ] On my CentOS 5.1 server, this gives me the following error... ./test_file.scr: line 3: [: too many arguments Can anyone explain why the difference and suggest something that makes both cases

Re: [CentOS] shell script strangeness...

2008-05-15 Thread Ian Blackwell
Craig White wrote: On my CentOS 4.6 server, this works... if [ -z `grep entry_chooser.js /var/log/httpd/access_log` ] On my CentOS 5.1 server, this gives me the following error... ./test_file.scr: line 3: [: too many arguments Can anyone explain why the difference and suggest something that

Re: [CentOS] shell script strangeness...

2008-05-15 Thread Garrick Staples
On Fri, May 16, 2008 at 02:07:10PM +0930, Ian Blackwell alleged: Craig White wrote: On my CentOS 4.6 server, this works... if [ -z `grep entry_chooser.js /var/log/httpd/access_log` ] On my CentOS 5.1 server, this gives me the following error... ./test_file.scr: line 3: [: too many

Re: [CentOS] shell script strangeness...

2008-05-15 Thread Craig White
On Fri, 2008-05-16 at 14:07 +0930, Ian Blackwell wrote: Craig White wrote: On my CentOS 4.6 server, this works... if [ -z `grep entry_chooser.js /var/log/httpd/access_log` ] On my CentOS 5.1 server, this gives me the following error... ./test_file.scr: line 3: [: too many arguments

Re: [CentOS] shell script strangeness...

2008-05-15 Thread Craig White
On Thu, 2008-05-15 at 22:00 -0700, Garrick Staples wrote: On Fri, May 16, 2008 at 02:07:10PM +0930, Ian Blackwell alleged: Craig White wrote: On my CentOS 4.6 server, this works... if [ -z `grep entry_chooser.js /var/log/httpd/access_log` ] On my CentOS 5.1 server, this gives me the

Re: [CentOS] shell script question

2008-03-16 Thread Marcelo Roccasalva
On Thu, Mar 13, 2008 at 12:04 PM, Jerry Geis [EMAIL PROTECTED] wrote: hi all, If I have a shell script on 5.1 that has 2 commands in the script... command1 command2 and command1 runs until it is kill'ed by some other process. Sometimes command2 runs and sometimes it doesnt (this is what

[CentOS] shell script question

2008-03-13 Thread Jerry Geis
hi all, If I have a shell script on 5.1 that has 2 commands in the script... command1 command2 and command1 runs until it is kill'ed by some other process. Sometimes command2 runs and sometimes it doesnt (this is what it seems like). How can I be ensured that command2 will always run after

Re: [CentOS] shell script question

2008-03-13 Thread Fajar Priyanto
On Thursday 13 March 2008 22:04:23 Jerry Geis wrote: If I have a shell script on 5.1 that has 2 commands in the script... command1 command2 and command1 runs until it is kill'ed by some other process. Sometimes command2 runs and sometimes it doesnt (this is what it seems like). How can I

Re: [CentOS] shell script question

2008-03-13 Thread Garrick Staples
On Thu, Mar 13, 2008 at 11:04:23AM -0400, Jerry Geis alleged: hi all, If I have a shell script on 5.1 that has 2 commands in the script... command1 command2 and command1 runs until it is kill'ed by some other process. Sometimes command2 runs and sometimes it doesnt (this is what it

Re: [CentOS] shell script question

2008-03-13 Thread Garrick Staples
On Thu, Mar 13, 2008 at 10:29:58PM +0700, Fajar Priyanto alleged: On Thursday 13 March 2008 22:04:23 Jerry Geis wrote: If I have a shell script on 5.1 that has 2 commands in the script... command1 command2 and command1 runs until it is kill'ed by some other process. Sometimes