Operating System - HP-UX
1826382 Members
4297 Online
109692 Solutions
New Discussion

Re: Running nickel through cron

 
HutchAdmin
Occasional Advisor

Running nickel through cron

I want to run nickel utility on my HPUX11.11 (SD32) through cron. I have already created a script which call nickel, write logs, and send the completion status through e-mail. I am able to run that scripts through shell but it is not running through cron.

CRON ENTRY
---------------------------------------
00 11 * * * su - root -c "/usr/bin/sh /opt/contrib/bin/nickel_out.sh > /dev/null 2>/dev/null"
----------------------------------------

ERROR IN LOGS
--------------------------------------
################################## STARTING NICKEL Mon Oct 29 14:10:00 IST 2007 ##############
process not attached to terminal
Usage: who [-rbtpludAasHTqRm] [am i] [utmp_like_file]

r run level
b boot time
t time changes
p processes other than getty or users
l login processes
u useful information
d dead processes
A accounting information
a all (rbtpludA options)
s short form of who (no time since last output or pid)
H print header
T status of tty (+ writable, - not writable, x exclusive open, ? hung)
q quick who
R print host name

ERROR: The tool is already running under pid: 19416

You must wait until it completes.

###################################### END NICKEL Mon Oct 29 14:10:01 IST 2007 ###################
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: Running nickel through cron

Shalom,

cron lackes necessary environment.

Have your script source /etc/profile and .profile for the intended user and most of these issues will probably be resolved.

Or do it manually

Command line

stty -a (make sure that env is duplicated in your script)
env > env.txt

Make sure that environment, especially PATH.

ERROR: The tool is already running under pid: 19416
Make sure the tool is only running once. It seems to object to being run twice.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
HutchAdmin
Occasional Advisor

Re: Running nickel through cron

>>>
ERROR: The tool is already running under pid: 19416
>>>

Never found no tool running at that time when my cron ( nickel) runs, I checked the using.
#ps -aef|grep
#ps -aef|grep -i nickel
Peter Nikitka
Honored Contributor

Re: Running nickel through cron

Hi,

I suspect, that the last error shown
>>
ERROR: The tool is already running under pid: 19416
<<
is a followup caused by the error at startup.

- Why do you use a
su - root -c "..."
as a cron command?
The crontab entry done by user 'root', so no 'su' is required.

- The errors
>>
process not attached to terminal
Usage: who [-rbtpludAasHTqRm] [am i] [utmp_like_file]
<<
are for sure caused by sourcing .profile via "su - ...".

For this I recommend to transfer the setup of the environment needed for running nickel in a seperate file - e.g. /var/opt/nickelrc and sourcing that in .profile as well as in the crontab entry.

Then you could modify your crontab entry to
00 11 * * * . /var/opt/nickelrc;/opt/contrib/bin/nickel_out.sh >/dev/null 2>&1

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Anshumali
Esteemed Contributor

Re: Running nickel through cron

Do you have who -m or whoami in your profile?
When a command is executed via cron, there is no tty or pty terminal associated with the process. so you may try excecuting it with su without "-" option, set the enviroment for the cron manually as SEP said:
env > env.txt


Anshumali

Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
Anshumali
Esteemed Contributor

Re: Running nickel through cron

BTW does the exchange support 10Mb attchment(If i am not wrong about nickel output) file thorugh Relayed Exchange in hutch...You may also think to zip it before you create this much of traffic. :)

VEL,Mum :)

Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
HutchAdmin
Occasional Advisor

Re: Running nickel through cron

Anshu,
I am not e-mailing the nickel output but the logs only to confirm if my nickel created successfully or not. So 10MB limitation :) is taken care.

Thanks,