Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 23rd, 2008, 10:35 AM
flashbck's Avatar
flashbck flashbck is offline
/* Spawn Killer Killer */
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Nov 2004
Location: New Orleans, LA, USA
Posts: 1,145 flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 3924 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 19 h 12 m 30 sec
Reputation Power: 203
Cron.daily script isn't running as I would expect

I've got a CentOS 5 box that is running 2 websites right now. I've got webalizer on the server and it currently generates statistics on only one of the sites as I have the second site using it's own access and error logs. I wanted to have webalizer analyze the log from the second site as well so I created a new .conf file for the second site and edited the /etc/cron.daily/00webalizer script to run webalizer a second time with the new .conf file. Unfortunately, the second run isn't taking place. I tried running the 00webalizer script manually with some echo statements in it and it never reaches the second if statement. Here is a log of my actions:
Code:
[root@computer cron.daily]# pwd
/etc/cron.daily
[root@computer cron.daily]#
[root@computer cron.daily]#
[root@computer cron.daily]# cat 00webalizer
#! /bin/bash
# update access statistics for the web site

if [ -s /var/log/httpd/access_log ]; then
   echo "Normal"
   exec /usr/bin/webalizer -Q
fi


#birchrock.org stats
if [ -s /var/log/httpd/birchrock.org-access_log ]; then
   echo "BRC"
   exec /usr/bin/webalizer -Q -c /etc/webalizer/birchrock.org.conf
fi
[root@computer cron.daily]#
[root@computer cron.daily]#
[root@computer cron.daily]# ./00webalizer
Normal
[root@computer cron.daily]#
[root@computer cron.daily]#
[root@computer cron.daily]# cd
[root@computer ~]#
[root@computer ~]#
[root@computer ~]# cat 00webalizer
#! /bin/bash
# update access statistics for the web site

if [ -s /var/log/httpd/access_log ]; then
   echo "Normal"
fi


#birchrock.org stats
if [ -s /var/log/httpd/birchrock.org-access_log ]; then
   echo "BRC"
fi
[root@computer ~]#
[root@computer ~]#
[root@computer ~]# ./00webalizer
Normal
BRC
[root@computer ~]#
any thoughts as to what I'm doing wrong? As you can see from the version of 00webalizer that I copied to the root home directory, the second if statement is processed correctly when I remove the exec commands from the script. Admittedly, I'm no bash scripting guru so I have no idea what the problem can be. Thanks in advance.

Reply With Quote
  #2  
Old April 24th, 2008, 05:35 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Novice (500 - 999 posts) Click here for more information
 
Join Date: Mar 2006
Posts: 609 SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 8 m 27 sec
Reputation Power: 194
Why do you wish to use exec? You should just be able to call the command direct: /usr/bin/webalizer -Q. IIRC the exec will cause it to in effect become the active process in place, so when it exits so will what called it.
Comments on this post
flashbck agrees: Perfect! Thanks for your help.
__________________
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer" - Bruce Graham

Reply With Quote
  #3  
Old April 24th, 2008, 09:57 AM
flashbck's Avatar
flashbck flashbck is offline
/* Spawn Killer Killer */
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Nov 2004
Location: New Orleans, LA, USA
Posts: 1,145 flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)flashbck User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 3924 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 19 h 12 m 30 sec
Reputation Power: 203
Quote:
Originally Posted by SimonJM
Why do you wish to use exec? You should just be able to call the command direct: /usr/bin/webalizer -Q. IIRC the exec will cause it to in effect become the active process in place, so when it exits so will what called it.
That makes perfect sense! I was only using exec because the original script was written that way.

Just made the changes and it works just as I would like. Thank you.

Reply With Quote
  #4  
Old April 25th, 2008, 02:20 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Novice (500 - 999 posts) Click here for more information
 
Join Date: Mar 2006
Posts: 609 SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level)SimonJM User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 8 m 27 sec
Reputation Power: 194
Only to happy to be useful!

Reply With Quote
  #5  
Old April 27th, 2008, 11:02 PM
MicrosonicHost MicrosonicHost is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 6 MicrosonicHost User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 53 sec
Reputation Power: 0
glad to see this got fixed

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Cron.daily script isn't running as I would expect


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway