[vox-tech] Cron Script Error
Samuel Merritt
vox-tech@lists.lugod.org
Tue, 26 Aug 2003 15:31:13 -0700 (PDT)
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.