Stipple runs in cli but not in cron?

Hi there
this is a GENERAL question so I didn’t include any code. I also am aware of julia packages that allow cronlike behavior but I would prefer to keep this simple.

I’m running a stipple julia script to build a web page and it works WONDERFULLY when I run it from the linux mint ( 20.3) terminal. BUT when I put the same script in a cronjob it doesn’t work. There are no log errors from the cronjob. The scripts have printlns in them for debug purposes, I can’t see why that would make a difference. I have made sure that the script call in the cronjob contains the correct path.

dave@deepthought:~$ julia /home/dave/tontine_2022/2022_live/8_3_22_stpl_pull.jl

and the crontab entry

00 11  * * 2  julia /home/dave/tontine_2022/2022_live/8_3_22_stpl_pull.jl 

I run python scripts in the crontab all the time with no issues.

Is there something I am missing between running from cli and cron with regard to stipple or julia?

how could I diagnose this issue please?

1 Like

First check:
give the complete path to the julia executable on your system. You can get it from the shell prompt with:

which julia

In crontab change julia to /complete/path/to/julia

1 Like

@oheil thanks for the suggestion. AGAIN I should really have thought of that :frowning: I have to wait until tomorrow ( only allowed 1 mess up per day ) to see if the change to the crontab works but the line now is

00 3  * * 3          /home/dave/.julia/juliaup/bin/julia  /home/dave/tontine_2022/2022_live/8_3_22_stpl_pull.jl 

Fingers crossed. Thanks again for the help always appreciated.

1 Like

Thank you @oheil , it worked. The full qualification that you suggested did the job

00 3  * * 3          /home/dave/.julia/juliaup/bin/julia  /home/dave/tontine_2022/2022_live/8_3_22_stpl_pull.jl

You have made me a happy bunny and, as penance, I’ll spend some time working out why cron doesn’t use the same path as cli. Thanks again for taking the time.
theakson

1 Like

That’s easy to tell:
crond starts in a different environment, typically stripped down to only basic PATHs and other environment variables. As a user on the system you get the full environment needed for all the things installed on the system.
Create a cron job which runs just env > /home/dave/crond_env.out 2>&1 and see what you get in the output file. Compare it to env in your shell.

I am happy that you are happy! :wink:

Hi there @oheil

thanks again for ALL your help. Linux, together with so many other things, is not my strong suit. So I read your explanation ( excellent thanks) and decided to dig a little deeper ( which is what I should have done before bothering you) and found

man 5 crontab

which says

Several environment variables are set up automatically by  the  cron(8)
       daemon.  SHELL is set to /bin/sh, and LOGNAME and HOME are set from the
       /etc/passwd  line  of  the   crontab's   owner.    PATH   is   set   to
       "/usr/bin:/bin".   HOME,  SHELL, and PATH may be overridden by settings
       in the crontab; LOGNAME is the user that the job is running  from,  and
       may not be changed.

I KEEP forgetting that crontab is designed for a multiuser environment. Thanks again and I can only hope that someone else will benefit from my ignorance and your kindness.

theakson

1 Like