ispCP - Board - Support
Missing "&" in the cron ? - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: Usage (/forum-34.html)
+--- Thread: Missing "&" in the cron ? (/thread-2454.html)



Missing "&" in the cron ? - FeG - 02-15-2008 09:44 PM

Hi..

I've got a question related to this ticket (created by BeNe):

After upgrading from RC2c to RC3 (and activating AWStats thereby), I get mails like this every 30min:

Quote:Subject: Cron <root@hostname> /var/www/ispcp/engine/traffic/ispcp-vrl-traff >/var/log/ispcp/ispcp-vrl-traff.log

/usr/bin/diff: /var/log/ispcp/domain.de-traf.log: No such file or directory
/usr/bin/diff: /var/log/ispcp/domain.de-traf.log: No such file or directory
/bin/mv: cannot stat `/var/log/ispcp/domain.de-traf.log': No such file or directory
sys_command() | ERROR: External command '/bin/mv /var/log/ispcp/domain.de-traf.log /var/log/ispcp/domain.de-traf.log.prev' returned '1' status !
sys_command() | Starting...
diff_command() | Ending...
diff_command() | Starting...
diff_command() | ERORR: '/usr/bin/diff -a -q /var/log/ispcp/domain.de-traf.log /var/log/ispcp/domain.de-traf.log.prev' returned '2' !
diff_command() | Starting...
sys_command('/bin/cp /var/log/apache2/domain.de-traf.log /var/log/ispcp/domain.de-traf.log') | Ending...
sys_command() | Starting...
gen_log_file() | Starting...
collect_http_traffic() | Starting...
vrl_traff_engine() | Starting...
vrl_traff_start_up() | Ending...
zero_traffic_entries() | Ending...
zero_traffic_entries() | Starting...
doSQL() | Ending...
doSQL() | Starting...
doSQL() | Ending...
doSQL() | Starting...
doSQL() | Ending...
doSQL() | Starting...
get_conf() | Ending...
setup_main_vars() | Ending...
decrypt_db_password() | Ending...
decrypt_db_password() | Starting...
setup_main_vars() | Starting...
get_file() | Ending...
get_file() | Starting...
get_conf() | Starting...
vrl_traff_start_up() | Starting...
get_conf() | Ending...
setup_main_vars() | Ending...
decrypt_db_password() | Ending...
decrypt_db_password() | Starting...
setup_main_vars() | Starting...
get_file() | Ending...
get_file() | Starting...
get_conf() | Starting...

The domain mentioned there isn't always the same, there are even sometimes different domains occuring in one mail. Furthermore I don't get such a mail every 30min, but mostly.

My question is: Is this behaviour normal and there is - as stated by BeNe in the ticket - only a "&" missing to suppress the errors or is something wrong with my logfiles?

Thanks in advance,
FeG


RE: Missing "&" in the cron ? - joximu - 02-15-2008 09:53 PM

Normally you put a & after a command to get back to the shell and letting the command run "in behind"...
I wrote something in the ticket - I think the & are not needed.

You should look at the log files mentioned in the message...


RE: Missing "&" in the cron ? - FeG - 02-15-2008 10:12 PM

joximu Wrote:Normally you put a & after a command to get back to the shell and letting the command run "in behind"...

That's korrekt, if it's only a &, but &> means something else: It redirects stdout and stderr (output and error-output) to the given file. (see http://www.faqs.org/docs/Linux-HOWTO/Bash-Prog-Intro-HOWTO.html#ss3.6)

Therefore, maybe it is missing at this point.

Quote:You should look at the log files mentioned in the message...

The error is No such file or directory - so it'll be difficult to look at the log files Wink

Greetings
FeG


RE: Missing "&" in the cron ? - joximu - 02-15-2008 10:19 PM

ok, just learned something :-)

so it's more or less an abbr. for

command > ... 2> ....
or
command 1> ... 2> ....

thanx - I never used this syntax.

But it should not cause any problems - the only thing:
errorr are mailed instead of logged...

/J


RE: Missing "&" in the cron ? - FeG - 02-15-2008 10:48 PM

joximu Wrote:But it should not cause any problems - the only thing:
errorr are mailed instead of logged...

Sure it doesn't cause problems, but my question was if these errors I quoted above are normal behaviour.

I guess they aren't, because otherwise there'd be some posts about this problem here...

So does anyone knows what causes this problem?

Greetings
FeG


RE: Missing "&" in the cron ? - joximu - 02-15-2008 11:37 PM

Maybe there is not traffic at all for some domains - then there may be no log file (just an idea).
If you add the & just before the > then you won't see theese messages.

of course: the diff command should not be executed if the mv was not ok... Smile


RE: Missing "&" in the cron ? - FeG - 02-18-2008 06:33 PM

Does anybody can verify that this is normal behaviour so there's nothing wrong with adding "&>" to this line?


RE: Missing "&" in the cron ? - FeG - 02-18-2008 06:51 PM

I've just detected another problem connected with this:

The daily cronjob causes an error, sent to me by mail:

Quote:error: error running prerotate script for /var/log/proftpd/ftp_traff.log, leaving old log in place
run-parts: /etc/cron.daily/logrotate exited with return code 1

The log-rotation for ftp_traff.log is defined as follows:

Code:
/var/log/proftpd/ftp_traff.log {
  daily
  rotate 7
  missingok
  compress
  delaycompress
  prerotate
    /var/www/ispcp/engine/traffic/ispcp-vrl-traff > /var/log/ispcp/ispcp-vrl-traff.log
  endscript
  postrotate
    /usr/bin/killall -HUP syslogd
  endscript
}

So here is ispcp-vrl-traff also called without an & ..

Again my question: Is it normal that this script causes errors (i.e. if, as joximu said, a domain hadn't caused any traffic this day) or is there a problem with my logfiles?

Greetings
FeG


RE: Missing "&" in the cron ? - FeG - 02-20-2008 10:37 PM

Can anyone check this with his installation? I'm sure I'm not the only one having domains on my system that perhaps doesn't cause traffic one day.


RE: Missing "&" in the cron ? - Cube - 02-20-2008 11:49 PM

I have such domains, but I don't get this error.