On 2003.08.26 15:31, Samuel Merritt wrote:

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.

I think that he wants to clobber with the clear command (and thereby make the first character of /etc/issue a control character that clears the screen). Using TERM=linux where I have inserted it will solve the TERM environment variable not set error. (Use of TERM=linux should be preferred over TERM=vt100, because you know practically for certain that /etc/issue will only be printed to the linux console)

My suggestion regarding this:

YELLOW="\033[1;33m" # Light Red

- /usr/bin/clear >> /etc/issue
- printf "\e[2J\e[H" > /etc/issue
+ TERM=linux /usr/bin/clear > /etc/issue
+ printf "\e[2J\e[H" >> /etc/issue
  echo -e " " >> /etc/issue

As for your other problem, the username field is only used in the global crontab, and is never used in the crontab that you edit using `crontab -e`. As a result, "root" is being interpreted as a command, not a username. Login as root and run crontab -e, or run
sudo crontab -e. Set up the cronjob there.

>>
>>
>> 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 <[EMAIL PROTECTED]>
>> To: [EMAIL PROTECTED]
>> Subject: Cron <[EMAIL PROTECTED]>  /etc/init.d/issue
>>
>> TERM environment variable not set.
>> ********************************************************
>> Date: Tue, 26 Aug 2003 12:35:00 -0700 (PDT)
>> From: Cron Daemon <[EMAIL PROTECTED]>
>> To: [EMAIL PROTECTED]
>> Subject: Cron <[EMAIL PROTECTED]> root /etc/init.d/issue
>>
>> /bin/sh: line 1: root: command not found
>> ********************************************************
>>
>> Any suggestions would be greatly appriciated.
>>
>> _______________________________________________
>> vox-tech mailing list
>> [EMAIL PROTECTED]
>> http://lists.lugod.org/mailman/listinfo/vox-tech
>
> _______________________________________________
> vox-tech mailing list
> [EMAIL PROTECTED]
> 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 [EMAIL PROTECTED] http://lists.lugod.org/mailman/listinfo/vox-tech



--
I usually have a GPG digital signature included as an attachment.
See http://www.gnupg.org/ for info about these digital signatures.
My key was last signed 6/10/2003. If you use GPG, *please* see me about signing the key. ***** My computer can't give you viruses by email. ***

Attachment: pgp00000.pgp
Description: PGP signature



Reply via email to