l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 20: Web Application Hacking: How to Make and Break Security on the Web
Next Installfest:
TBD
Latest News:
Oct. 10: LUGOD Installfests coming again soon
Page last updated:
2003 Aug 26 20:16

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Cron Script Error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Cron Script Error



Tim Riley said:
>
>
> Daniel Hurt wrote:
>
>> Greetings.  I have written a small shell script to modify the login
>> prompt at certain intervals, just for entertainment purposes.  The
>> when I run the script from the shell prompt it runs fine, but when I
>> execute it as cron job, I receive several errors in via email.  I am
>> using Vcron as the cron daemon.
>>
>> The crontab entry is as follows:
>>
>> */15 * * * *     root    /etc/init.d/issue
>
> This "root" is giving you the "root: command not found" error.
> The sixth parameter is the command to execute.
>
> As far as the "TERM environment variable not set" error:
> I think the "clear" command is generating this.
> Just set "export TERM=vt100" at the top of the script.


It looks to me like the /usr/bin/clear isn't needed at all. Right below
that, he's got the lineprintf "\e[2J\e[H" > /etc/issue
whicl will clobber /etc/issue, including anything that "clear" appended to
it.
>>
>>
>> The script /etc/init.d/issue contains the following:
>> ********************************************************
>> #!/bin/bash
>>
>> R=$(cat /etc/gentoo-release | awk '{ print $5,$6 }')
>> C=$(cat /proc/cpuinfo | grep 'model name' | awk '{ print $4,$5,$6 }')
>> CS=$(cat /proc/cpuinfo | grep 'cpu MHz' | awk '{ print $4 }')
>> CB=$(cat /proc/cpuinfo | grep 'bogomips' | awk '{ print $3 }')
>> K=$(uname -r)
>> H=$(/bin/hostname -f)
>> M=$(( `dmesg | grep "Dentry" | awk '{print $9}'` / 1024 ))
>> KS=`dmesg | grep "Swap" | awk '{print $3}'`
>> S=$(( ${KS%k} / 1024 ))
>> U=$(uptime)
>> F=$(fortune 40% calvin 30% hitchhiker 10% chalkboard 10% starwars 10%
>> bofh- excuses)
>>
>> DARK="\033[1;30m" # dark grey
>> GREY="\033[0m" # default grey / white
>> WHITE="\033[1;37m" # bright / bold white
>> PURPLE="\033[0;35m" # purple
>> BR_GREEN="\033[1;32m" # bright green
>> BR_BLUE="\033[1;34m" # bright blue
>> BLACK="\033[0;30m" # black
>> RED="\033[0;31m" # Red
>> LT_RED="\033[1;31m" # Light Red
>> YELLOW="\033[1;33m" # Light Red
>>
>> /usr/bin/clear >> /etc/issue
>> printf "\e[2J\e[H" > /etc/issue
>> echo -e " " >> /etc/issue
>> echo -e "$BR_GREEN Gentoo$BR_BLUE Linux$RED Release $R" >> /etc/issue
>> echo -e " " >> /etc/issue
>> echo -e "$GREY Hostname: $WHITE $H" >> /etc/issue
>> echo -e " " >> /etc/issue
>> echo -e "$GREY Kernel:   $WHITE $K" >> /etc/issue
>> echo -e "$GREY Processor:$WHITE $C ( $CS MHz => $CB bogomips)"
>> >> /etc/issue
>> echo -e "$GREY Memory:   $WHITE $M Mb    $GREY Swap:  $WHITE $S Mb"
>> >> /etc/issue
>> echo -e "$GREY Uptime:  $WHITE $U" >> /etc/issue
>> echo -e " " >> /etc/issue
>> echo -e "$YELLOW$F$WHITE" >> /etc/issue
>> echo -e " " >> /etc/issue
>> cp /etc/issue /etc/issue.net
>> ********************************************************
>>
>> The two errors that I am recieving are as follows:
>> ********************************************************
>> Date: Tue, 26 Aug 2003 12:35:00 -0700 (PDT)
>> From: Cron Daemon <root@mcising.net>
>> To: root@mcising.net
>> Subject: Cron <root@shadow>  /etc/init.d/issue
>>
>> TERM environment variable not set.
>> ********************************************************
>> Date: Tue, 26 Aug 2003 12:35:00 -0700 (PDT)
>> From: Cron Daemon <root@mcising.net>
>> To: root@mcising.net
>> Subject: Cron <root@shadow> root /etc/init.d/issue
>>
>> /bin/sh: line 1: root: command not found
>> ********************************************************
>>
>> Any suggestions would be greatly appriciated.
>>
>> _______________________________________________
>> vox-tech mailing list
>> vox-tech@lists.lugod.org
>> http://lists.lugod.org/mailman/listinfo/vox-tech
>
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech


-- 
No PGP signature because I'm far from home and sending via webmail.


_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.