l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Aug 27 08:32

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)
[vox-tech] Cron Script Error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] Cron Script Error

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 

The crontab entry is as follows:

*/15 * * * *     root    /etc/init.d/issue

The script /etc/init.d/issue contains the following:

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 ))
F=$(fortune 40% calvin 30% hitchhiker 10% chalkboard 10% starwars 10% bofh-

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

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
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:
O'Reilly and Associates
For numerous book donations.