Operating System - HP-UX
1836392 Members
3372 Online
110100 Solutions
New Discussion

Re: Nickel not running from the cron

 
SOLVED
Go to solution
Coolmar
Esteemed Contributor

Nickel not running from the cron

I'm sure it is something simple that I am missing but just can't see it. I can run the command from the CL and it is fine, but from cron it just doesn't run.

20 14 * * * /opt/contrib/bin/nickel -m email@mail.com >/dev/null
4 REPLIES 4
Pete Randall
Outstanding Contributor
Solution

Re: Nickel not running from the cron

Usually, when jobs run from the command line, but not from cron, it is because of the sparse environment provided by cron. The PATH is limited and evironment variables that you would normally expect to be set are not. I suspect that the nickel you invoke is a script and it has some non-full path names. These could probably be fixed by adding a PATH statement into a script that cron executes, then having that script invoke nickel.


Pete

Pete
Coolmar
Esteemed Contributor

Re: Nickel not running from the cron

Do you mean by doing the following:

su - root -c "command"
spex
Honored Contributor

Re: Nickel not running from the cron

Coolmar,

The method you gave is another way to flesh out the environment. Pete suggests creating a script to set the PATH environmental variable, and then execute the nickel binary. For example,

# cat nickel-wrapper.sh
#!/usr/bin/sh
PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/contrib/bin:/opt/contrib/bin
#set other environmental variables here...
/opt/contrib/bin/nickel -m email@mail.com
exit

Then change your crontab entry to:
20 14 * * * /path/to/nickel-wrapper.sh 1> /dev/null

PCS
Coolmar
Esteemed Contributor

Re: Nickel not running from the cron

Worked...thanks!