The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
problem with shell script execution anju Shell Programming and Scripting 2 05-08-2008 01:50 AM
Sequential execution in shell script? chengwei UNIX for Dummies Questions & Answers 6 03-30-2007 12:10 AM
Scheduling the execution of a shell script sumesh.abraham Shell Programming and Scripting 1 12-06-2006 07:25 AM
Logging OWB mapping execution in Shell script npn Shell Programming and Scripting 1 11-16-2006 09:25 AM
execution of shell script malaymaru Shell Programming and Scripting 5 06-13-2005 09:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-08-2008
ashish.sharma ashish.sharma is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 1
Cron execution of shell script

Hi Guys,
Unable to run this script from the cron,although the same executes perfectly from the command line.Please help.


#!/bin/sh

#### aprintd alarm creation files #####

file=`date +%m%d%Y`
pid=$$
echo "$pid"
/u01/app/netboss/bin/aprintd/aprintd > $file &
childpid=$!
echo "$childpid"
while .
do

time=`date +%H%M%S`
if [ $time -eq 050000 ]
then
kill $childpid
echo "if loop"
kill $pid
fi
done
  #2 (permalink)  
Old 09-08-2008
nelson_ulht nelson_ulht is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 3
Hi there...

Normally when you can't execute a script in cron and manually ok the problem is the envroment variables....

Try to insert in the script:
export PATH=.........

or if .profile has the correct PATH execute it in the script.
  #3 (permalink)  
Old 09-08-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
I think you meant while :, not while .?
  #4 (permalink)  
Old 09-08-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,259
Btw: There is a search function here in the forum and if you use patterns like "cron" and "script" you get a lot of close hits. Also if you have errors to show us, please post them too.


Source your neeed environment files like for example ".profile" in the head of the script because when it's running under cron, they will not be used automatically. Also you might use absolute paths if something is not found.

Example:
Code:
. ~myuser/.profile
...yourscript comes here....
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:14 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0