The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
found error 138 while run shell script rinku Shell Programming and Scripting 1 06-01-2008 11:29 PM
Shell script run error ksh: not found nz80qy Shell Programming and Scripting 3 03-25-2008 07:57 AM
Installer script -- function not found error asutoshch Shell Programming and Scripting 1 07-10-2006 11:07 AM
Newb question daeglin UNIX for Dummies Questions & Answers 4 10-15-2004 02:24 AM
newb shell question Fokus Shell Programming and Scripting 2 12-13-2001 11:08 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-03-2006
Registered User
 

Join Date: Mar 2006
Posts: 6
Newb scripting question, I get the error script not found

This is probably a really simple problem, but goes easy on me I'm still a newb. The problem I have is that a script (we'll call it script.script) I edited won't run for some reason, I get the error "ksh: script.script: not found"


The location of my script is as follows: /home/users/arkitech

The actual script I'm running looks like this:
[q]
#!/bin/perl -w
#
##########################################################################
# NAME: script.script
# SYNOPSIS: script provides daily monitoring of system activity &
# disk usage
##########################################################################
# DECLARE VARIABLES
use strict;

companyservername:/home/users/arkitech-> whence sendmail /usr/sbin/sendmail

my @sar = qx(/bin/sar);
my @space = qx(/bin/df -k /dev/vx/dsk/elephant_fs/p1* | grep -v "Filesystem");
my $to = 'arkitech@att.com'; #
my $from = 'companyaddress@msg.ameritech.com';
my $date = scalar(localtime);
my $fs;
my $newfs;
my $kbytes;
my $used;
my $avail;
my $capacity;
my $mounted;

open(SENDMAIL, "|/usr/lib/sendmail -t ") or die ("Can't fork for sendmail daemon: $!\n");

print SENDMAIL "From: <",$from,">\n";
print SENDMAIL "To: ",$to,"\n";
print SENDMAIL "Subject: ODR daily capacity monitor\n";
print SENDMAIL "Reporting on ", $date, "\n\n";
print SENDMAIL "System Activity\n";
print SENDMAIL "-----------------\n";
print SENDMAIL @sar, "\n\n\n";
print SENDMAIL "Disk Usage\n";
print SENDMAIL "------------\n\n";
print SENDMAIL "Filesystem \t\tkbytes \tused \tAvailable\tcapacity\t Mounted on\n";
print SENDMAIL "------------------\t----------\t---------\t---------\t--------\t -------------------\n";

format SENDMAIL =
@<<<<<<<<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<<<<<<<<<<
$newfs, $kbytes, $used, $avail, $capacity, $mounted
.

foreach (@space) {
chomp;
($fs, $kbytes, $used, $avail, $capacity, $mounted) = split(/\s+/, $_);
$newfs = substr($fs, 24);
write SENDMAIL;
}

print SENDMAIL "\n\nEnd of Report.\n\n";

close(SENDMAIL) or warn ("sendmail didn't close nicely! $!\n");
[/q]

Thanks for any help
Reply With Quote
Forum Sponsor
  #2  
Old 05-03-2006
Registered User
 

Join Date: Mar 2006
Location: Nashville
Posts: 77
My guess is that it can't find perl.

Do a 'which perl' and make sure you have the correct path listed in your script. It's normally not in /bin. It should be in /usr/bin or maybe even /opt.

-X
Reply With Quote
  #3  
Old 05-03-2006
indo1144's Avatar
Registered User
 

Join Date: Jun 2002
Location: Netherlands
Posts: 54
Quote:
Originally Posted by Arkitech
I get the error "ksh: script.script: not found"
When you start a script that's in the current workingdirectory, use ./script.script to start it. Just typing its name will not work, unless you put your current directory (specified by a single dot) in $PATH (which is generally a bad idea).

As an example, a simple script which just says "Hi".
Quote:
[roy@tatanka] roy $./scr
Hi
[roy@tatanka] roy $scr
-bash: scr: command not found
[roy@tatanka] roy $
Look familiar?
Reply With Quote
  #4  
Old 05-04-2006
Registered User
 

Join Date: Mar 2006
Posts: 6
Thanks Indo, that's exactly what the problem was. I attempted to run the script using just the file name.

Thanks again for the help
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0