SolarisCron job perl script execution error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SolarisCron job perl script execution error
# 1  
Old 02-05-2009
SolarisCron job perl script execution error

Hi,
I want to run a crontab job on solaris10.5. I have configured the crontab accordingly
10 * * * * /scripts/dbalter.pl >> /scripts/cronout.txt.However this does not work .Then I go to /var/mail/root and find an error in the output:
#################################################################################################### ##################################

From root@myserver Wed Feb 4 17:02:00 2009
Return-Path: <root@myserver>
Received: from myserver (localhost [127.0.0.1])
by myserver (8.13.8+Sun/8.13.8) with ESMTP id n14N20Rx027373
for <root@myserver>; Wed, 4 Feb 2009 17:02:00 -0600 (CST)
Received: (from root@localhost)
by myserver (8.13.8+Sun/8.13.8/Submit) id n14N20Is027371
for root; Wed, 4 Feb 2009 17:02:00 -0600 (CST)
Date: Wed, 4 Feb 2009 17:02:00 -0600 (CST)
From: Super-User <root@myserver>
Message-Id: <200902042302.n14N20Is027371@myserver>
To: root@myserver
Subject: Output from "cron" command
MIME-Version: 1.0
Content-Type: text/plain
Content-Length: 136

Your "cron" job on myserver
/usr/bin/perl/ /scripts/dbalter.pl

produced the following output:

sh: /usr/bin/perl/: cannot execute
#################################################################################################### ####################

bash-3.00£ env
LC_MONETARY=en_US.ISO8859-1
TERM=xterm
SHELL=/sbin/sh
SSH_CLIENT=138.85.45.27 28249 22
LC_NUMERIC=en_US.ISO8859-1
OLDPWD=/
SSH_TTY=/dev/pts/2
USER=root
PATH=/usr/sbin:/usr/bin
MAIL=/var/mail//root
LC_MESSAGES=C
LC_COLLATE=en_US.ISO8859-1
PWD=/var/adm
EDITOR=vi
TZ=US/Central
SHLVL=1
HOME=/
LOGNAME=root
SSH_CONNECTION=138.85.45.27 28249 10.25.30.190 22
LC_CTYPE=en_US.ISO8859-1
LC_TIME=en_US.ISO8859-1
_=/usr/bin/env
#################################################################################################### ###################3
Also I want to mail the output to an outlook account.Please let me know about it.I really appreciate the help.
Regards
Sonu
# 2  
Old 02-05-2009
Ok. The mail is telling you that /usr/bin/perl either doesn't exist or
you don't have permissions to execute it as this user.

Secondly, I believe you want to redirect stderr to your log also:

Code:
10 * * * * /scripts/dbalter.pl >> /scripts/cronout.txt 2>&1

# 3  
Old 02-06-2009
Hi quirkasaurus,
Thank you for your reply.I have changed the crontab file to the following

* * * * * perl /scripts/dbalter.pl >> /scripts/cronout.txt 2>&1
How it is executing and sending the output to the file.However on strange thing. When I execute the perl command from the directory where it is stored , in our case it is scripts directory.The script dbalter.pl , outputs all the info .
eg
cd script
perl test.pl

.....here us the output

however if I execute it from the / root I give the command like
perl /script/dbalter.pl which is the same as the crontab configuration.However I get the output of the first two lines and the last two lines.I dont know what is wrong here.
Again Thank you for your help.
Sonu
# 4  
Old 02-06-2009
not enough info, Sonu.

However, it looks like you need to fully qualify the path for the "cd" command.
That is, I'd do something like this:

Code:
cd /full_path/script

perl ./test.pl

.... coding it in such a way that it cannot be ambiguous.
# 5  
Old 02-06-2009
Hi quirkasaurus,
Thank You for your reply.It was stupic on my part. I when I was reading /writing from/to the file I was not supplyin the full path . as soon as i though that I rushed in here to delet my post .....lolz.....however I found your post . again thank you for your help.Thank You
Regards
Sonu
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execution problem with CRON job

HI, I have written an executable file in unix and I was able to execute it successfully but when I called this file with cron job it was giving error like "permission denied" and "No such file or directory". Please help in how cron calls the file and what permission is required on the file... (2 Replies)
Discussion started by: vipin kumar rai
2 Replies

2. Programming

Perl script remote execution as another user

Hi gurus, I have a requirement where I need to remotely run a perl script as another user. Running the script locally as the required user is fine, however I need to su with the script due to filesystem permission issues. I do not want to update permissions on the remote server due to security... (5 Replies)
Discussion started by: melias
5 Replies

3. Shell Programming and Scripting

Give input to a perl script while execution

Hi, I have a perl script which prints me the epoch value of a specific date and time given.Now I want to proceed to a next step ie i want to give the input at the time of execution. I have to initialise the date and time values in the script before executing it.But now i want to give the date... (3 Replies)
Discussion started by: jyothi_wipro
3 Replies

4. Shell Programming and Scripting

Parallel Job Execution

Hi All, At present I am using a UNIX Script which is running a set of JOBS. These JOBS are to be repeated for 20 times, means the same set of JOBS are repeated by just passing different arguments (From 1 to 20). Is there any way by which I can execute them parallel? At present its all... (4 Replies)
Discussion started by: Prashantckc
4 Replies

5. Solaris

Solaris 10.5 perl and cron job execution problem

Hi, I want to run a crontab job on solaris 10.5. I have configured the crontab accordingly 10 * * * * /scripts/dbalter.pl >> /scripts/cronout.txt However this does not work .Then I go to /var/mail/root and find an error in the output: From root@myserver Wed Feb 4 17:02:00 2009... (1 Reply)
Discussion started by: sonu2die4
1 Replies

6. UNIX for Dummies Questions & Answers

Confirm job execution

Hello everybody, Can anybody tell me how do we comfirm the execution of a scheduled job ? In other words, how do I know whether my scheduled script is being executed or not ? Thanks Jitu JK (2 Replies)
Discussion started by: jitu.jk
2 Replies

7. UNIX for Dummies Questions & Answers

a cron job needs a perl script to execute

Hello evreyone, this is my first post, and to say i'm new to this is an understatement. I know very little about perl scripts and hope some one can help me. i'm looking to get a script that a cron job can execute. what the script needs to to is 1) connect to a mysql database 2) go to a... (2 Replies)
Discussion started by: Exader
2 Replies

8. UNIX for Advanced & Expert Users

Job execution through Xming

Hello, Every evening I run few shell scripts on AIX Production Box, One shell script takes about one hour to complete and does some DB updation and application processing etc. The shell scripts are getting launched from prompt and not through cron or any scheduler as they require some manual... (0 Replies)
Discussion started by: panchpan
0 Replies

9. UNIX for Advanced & Expert Users

Cron job for Perl script

Although there are many threads on this forum regarding cron, none have specifically answered my question. So hopefully someone can shed some light on what I'm doing wrong.. I have a perl script that I want to run in a cron job. Since I've read that cron doesn't have any environments set, I... (3 Replies)
Discussion started by: man
3 Replies

10. Shell Programming and Scripting

How to determine if a script (perl) was called from a CRON job or commandline

Hi, Is there a way to determine if a Script is called from a CRON job or from a commandline Gerry. (2 Replies)
Discussion started by: jerryMcguire
2 Replies
Login or Register to Ask a Question