1831418 Members
3156 Online
110025 Solutions
New Discussion

Cron question

 
SOLVED
Go to solution
Brian Ham
Advisor

Cron question

I am trying to automate a script using cron. I can run/execute from command line: /var/adm/scripts/scriptname

When I set cron to run the job I receive command not found.

Any ideas?
3 REPLIES 3
John Poff
Honored Contributor
Solution

Re: Cron question

Hi,

Your cron job doesn't get the $PATH variable set like you do in a shell, so you might need to set the $PATH inside of your script. Also, make sure that the user running the cron job has access and permission to run the script, and that the full path to the script is specified in cron.

JP
Steven E. Protter
Exalted Contributor

Re: Cron question

No need to point this.

But /var filesystem is usually used for logs and other variable data, sometimes websites.

Scripts and such are USUALLY put somewhere in /usr

/usr is usually more stable in size and scripts don't grow so its a good place to put them.

Why am I bothering you about this? Because if someone else ever has to work on that system in an emergency, it might cause confusion.

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
Jose Ha
New Member

Re: Cron question

I believe the following paper can help you.

document description: cron: script works from command line but not from cron

document id: KBAN00000210