script/cron problems 
Author Message
 script/cron problems

I can run my awk script as root and it works great, however putting it into
root's crontab it strips out the awk variables (txt):

#!/bin/sh

repquota /users | grep days |

/usr/bin/awk -v dq='"' '

BEGIN {

Quote:
}

{
txt= txt $0 "\n"

Quote:
}

END {
 cmd= cmd "echo " dq "From: sysadmin\n"
 cmd= cmd "Subject: Daily Quota Report\n\n"
 cmd= cmd "These users have been sent an email apprising them of their disk
quotas:\n\n"
 cmd= cmd txt
 cmd= cmd "\n\n" dq "| /var/qmail/bin/qmail-inject -fsysadmin

 print cmd}' | /bin/sh 2>&1

--

When running from cron the "txt" string is missing.

Any ideas?

Patrick Price
Momentum Online



Sun, 15 Dec 2002 03:00:00 GMT  
 script/cron problems

Quote:

>I can run my awk script as root and it works great, however putting it into
>root's crontab it strips out the awk variables (txt):

>#!/bin/sh

>repquota /users | grep days |

>/usr/bin/awk -v dq='"' '

>BEGIN {
>}
>{
>txt= txt $0 "\n"
>}

>END {
> cmd= cmd "echo " dq "From: sysadmin\n"
> cmd= cmd "Subject: Daily Quota Report\n\n"
> cmd= cmd "These users have been sent an email apprising them of their disk
>quotas:\n\n"
> cmd= cmd txt
> cmd= cmd "\n\n" dq "| /var/qmail/bin/qmail-inject -fsysadmin

> print cmd}' | /bin/sh 2>&1

>--

>When running from cron the "txt" string is missing.

When you run a script from cron, it doesn't have the same PATH as when
you run it from the command line, so you either must set the path in
your  script, or fully qualify all commands and files used so that
the script will find them.

I suspect that your command isn't generating any input into your
awk command.

This is really a crontab question, and I believe is covered in the FAQ
for comp.unix.shell or comp.unix.questions and has been answered
many times in those newsgroups.

Check for posts about crontan and cron posted to those newsgroups
in deja.com

Chuck Demas
Needham, Mass.

--
  Eat Healthy    |   _ _   | Nothing would be done at all,

  Die Anyway     |    v    | That no one could find fault with it.



Sun, 15 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Still problems running script from cron

2. Problem running Python script as cron job

3. Problem Cron-Job using Python-Script

4. expect: problems running script from CRON

5. Problems running expect script in the background/from cron

6. problem running expect script via cron

7. Question about invoking a python script from cron ...

8. trouble running an expect script in cron versus command line

9. trouble running an Expect script from cron

10. Running expect scripts from cron..?

11. expect script doesn't work with cron - please help

12. script works from CL but not cron?

 

 
Powered by phpBB® Forum Software