|
[Sponsors] |
November 16, 2014, 12:51 |
cron and Paraview
|
#1 |
Senior Member
James
Join Date: May 2013
Posts: 116
Rep Power: 13 |
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. |
|
November 18, 2014, 11:40 |
|
#2 |
Senior Member
Stuart Buckingham
Join Date: May 2010
Location: United Kingdom
Posts: 267
Rep Power: 26 |
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 |
|
November 20, 2014, 10:19 |
|
#3 |
Senior Member
James
Join Date: May 2013
Posts: 116
Rep Power: 13 |
Hey Stuart,
Thanks for your reply. The problem is solved. It was related with paths and enviroment variables inside bashrc file. Best, James |
|
November 21, 2014, 17:59 |
|
#4 |
Senior Member
Stuart Buckingham
Join Date: May 2010
Location: United Kingdom
Posts: 267
Rep Power: 26 |
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 |
|
November 24, 2014, 07:02 |
|
#5 |
Member
Richardpluff
Join Date: May 2014
Posts: 95
Rep Power: 12 |
Please tell us how you did it, I had a similar problem in the past. How have you solve it?
|
|
November 24, 2014, 07:10 |
|
#6 |
Senior Member
James
Join Date: May 2013
Posts: 116
Rep Power: 13 |
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 |
|
|
|