CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [General] cron and Paraview (https://www.cfd-online.com/Forums/paraview/144546-cron-paraview.html)

Tensian November 16, 2014 12:51

cron and Paraview
 
Hi everyone,

I have created a cron that executes a Python script every 30 minutes. The cron in running well except when the script calls to ParaView.

The cron log file shows an error:"Segmentation fault"

All the task are behaving correctly, except those related to handle ParaView.

When I run the script directly fron the terminal:

python script.py

no error message is shown an everything works like expected.

Any ideas? It looks like cron in Ubuntu have problems handling software with graphical interface...

Thanks in advance.

stuart23 November 18, 2014 11:40

Hi James,

Cron does not know how to run an application in X because its environment is not inherited from your X instance. The answer is simple, have a look at this page: http://www.codecoffee.com/tipsforlinux/articles/23.html

Good luck,

Stu

Tensian November 20, 2014 10:19

Hey Stuart,

Thanks for your reply. The problem is solved. It was related with paths and enviroment variables inside bashrc file.

Best,

James

stuart23 November 21, 2014 17:59

Hi James,

Good to hear that you got it sorted. Can you tell us which envvars it was in particular so people who come across this issuel in the future will know?

Thanks

Stu

CRI_CFD November 24, 2014 07:02

Please tell us how you did it, I had a similar problem in the past. How have you solve it?

Tensian November 24, 2014 07:10

Sorry for the delay, I have absolutely forgotten this thread...

The problem was path and environment variables, in the following sense:

I have ParaView binaries in my desktop and in the system folder I have previous versions of Paraview.

When I ran my script directly using the terminal, the bashrc file has the information of path and environment variables (related to Python and Paraview) needed for a good behaviour of the script (path to desired version of Paraview, path to Python...)

When cron executes, this content seem to remain unknown, so the script tries to use an older version of ParavIew (which is partially deleted, I hae a little mess with this).

Solutions:1) include paths and environment variables in the cron or 2)create another script (.sh) that first of all execute the bashrc and later call the python script. In this case, the cron should call my_script.sh and my_script.sh should execute bashrc and my_python_srcipt.py in this order.

Hope this could help! If I could provide something more, please continue with this thread and I'll answer asap...

Regards,

J


All times are GMT -4. The time now is 04:18.