Environment variables for cron

hi,

i have a simple bash script that i am trying to run at a specified time as a crontab. the script is:

#!/bin/bash
cd /usr/local/MATLAB/R2012a/bin
./matlab -nodesktop -nosplash -r “magic(5), exit”

the script works perfect from the command line, however i cannot get it to run via cron.

what environment variables do i have to specify to get this script to run.

any help would be appreciated.

thanks

db (opensuse 12.1, KDE)

On 2012-08-03 02:16, blackbird sr71 wrote:
>
> hi,
>
> i have a simple bash script that i am trying to run at a specified time
> as a crontab. the script is:
>
> #!/bin/bash
> cd /usr/local/MATLAB/R2012a/bin
> /matlab -nodesktop -nosplash -r “magic(5), exit”
>
> the script works perfect from the command line, however i cannot get it
> to run via cron.
>
> what environment variables do i have to specify to get this script to
> run.

Basically all those that your program needs. Assume none are set.

Note: next time you send code like above, do so inside code tags.

Posting in Code Tags - A Guide

Some of that text got here incorrectly, can not run.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

I am no cron expert here, but these is a nice cron utility for KDE called kcron. Why not start YaST / Software / Software Management, search on kcron and when found, install it. It places a desktop icon at ** /usr/share/kde4/services/kcm_cron.desktop**, but you can create one in your desktop with this text:

[Desktop Entry]
Comment[en_US]=
Comment=
Exec=kcmshell4 kcm_cron
GenericName[en_US]=
GenericName=
Icon=package_yast_misc
MimeType=
Name[en_US]=Kcron
Name=Kcron
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=true
X-KDE-Username=
X-SuSE-translate=true

Copy the text from the code field to the text editor Kwrite and save it as the file $HOME/Desktop/Kcron.desktop and then mark it executable from terminal with the command:

chmod +x $HOME/Desktop/Kcron.desktop

I have set the options to Run as a different user so it asks for the root password, if you want a system wide cron entry. You should find a new desktop icon called Kcron. Click on it and see the new options for Cron there.

Thank You,

Have you set the cron daemon to be on? The switch is at Yast → System -=-> Runlevels → cron

Then if you want to set your crontable editor and/or make an entry in the crontable, have a read of this: Cron Tables (Crontab) in Suse / openSUSE [Event Scheduler for 10.x, 11.x]

I see the script (well, mangled, but the CODE tags are allready adivised to you), but the crontab entry is missing.

Please do post all that is obvious connected to what you describe.