![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strange error on mpack from cronjob | sentinel | Shell Programming and Scripting | 5 | 09-21-2008 10:46 AM |
| cronjob to run perl script | AirWalker83 | UNIX for Dummies Questions & Answers | 6 | 08-08-2008 03:53 AM |
| How to call a shellhaving sql script from cronjob | azum | Shell Programming and Scripting | 3 | 07-10-2008 09:22 AM |
| cronjob inside the script | namishtiwari | Shell Programming and Scripting | 3 | 02-04-2008 08:35 AM |
| help help cronjob problem with script | bucci | Shell Programming and Scripting | 4 | 02-10-2007 04:38 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
cronjob: Partial script error
Part of my script throws an error.
Your "cron" job on mitv-t-voms02 /usr/tlrscr/runhc.sh produced the following output: /usr/tlrscr/runhc.sh[15]: top: not found /usr/tlrscr/runhc.sh[17]: top: not found /usr/tlrscr/runhc.sh[18]: top: not found syntax error on line 1, teletype That part of script is : echo >> /usr/tlrscr/healthchk top -n 0 | grep -i memory >> /usr/tlrscr/healthchk echo >> /usr/tlrscr/healthchk totalmem=`top -n 0 | grep -i memory | awk '{print $2}' | sed 's/M//g'` free=`top -n 0 | grep -i memory | awk '{print $5}' | sed 's/M//g'` used=`echo "(($totalmem - $free)/$totalmem) * 100"| bc -l | sed -e "s/\(\.[0-9]\).*/\1/g"` echo "Physical memory usage is "$used% >> /usr/tlrscr/healthchk echo >> /usr/tlrscr/healthchk The script doesn't throw that error when executed manually. It only happens when it is run by cron at scheduled time. The "top" is available and can be excuted from command line. Anyone can help me? Why that part of script fails when run by cron? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|