Because in a process run from cron, you can only assume that your PATH variableQuote:>are set (RWX). Any ideas as to why the useradd does not work from cron'd
>script would be appreciated.
Why you can't accept the implications of your observationQuote:> (including the useradd) if run explicitly from the cmd line. The useradd cmd
> works fine run separately or in a script run from the cmd line. The shell
> script is owned by root and is part of the root grp. All of the permissions
> are set (RWX). Any ideas as to why the useradd does not work from cron'd
> script would be appreciated.
Peter
PATH=/usr/local/bin:/bin:/usr/bin/:/sbin:/usr/sbin
Another way is to call all commands using the full pathname,
and that can easily be done by using variables that are
configured at the top of a shells script.
#!/bin/sh
#
GREP="/usr/bin/grep -w"
LS=/bin/ls
${LS} /bin | ${GREP} ls
--
Floyd L. Davidson <http://www.ptialaska.net/~floyd>
1. Problem while running the Shell script as a cron job
Hi,
I am facing this weird problem on my AIX server (ver 4) :
I have a shell script that is supposed to read the return value from a
executable program and then take actions based on the value returned.
The script is like this:
#!/bin/ksh
###########################################################################
# Script: /celscripts/autosetupCheck.sh
#
# This script reads the numeric value returned by the executable
autoNPRCount
# and then sends out an email to the admin if the value is greater than
maxDepthMail
#
###########################################################################
maxDepthMail=500
MSG="Please check the NPR queue"
queueDepth=`/celutil/autoNPRCount`
if [ $queueDepth -ge $maxDepthMail ]
then
echo $MSG|mail -s "NPR alert" $ADMIN
fi
exit 0
When I run this script manually, it works perfectly fine. But, when I
run this script as a cron job, I get the following error:
/celscripts/autosetupCheck.sh[16]: 500: 0403-012 A test command
parameter is not valid
This error comes because the variable "queueDepth" is blank. Which
means that while running it as a cron job, the shell is not able to
assign the value returned by "autoNPRCount" to the varibale
"queueDepth".
Solutions/Suggestions for the above problem are most welcome.
Many Thanks,
Nishant
2. Creative 6x
3. Examples of shell scripts for (bash) for a ftp cron job?
5. script runs from shell but not when called as cron job???
6. server performance comparisons?
7. cron - shell script would not generate output in cron
8. mylex
9. Cron Problems - Script runs from shell but not cron
10. cron did not run root jobs (solaris 2.5.1)
11. Cron jobs running as something other than root
12. Solaris: root cron jobs halting