Tag Info

Hot answers tagged

8

This turns out to be easy. In Windows 7: Add C:\Program Files\Wolfram Research\Mathematica\9.0\ to the path. Write procedures for what you want to do in The Wolfram Language, and save in a .m file. Add MathKernel.exe -script filename.m to the Windows Task Scheduler. Specify that the job runs in the directory containing the .m file. That seems to be it. ...


7

I have automated a nightly backup process with Mathematica. I use a task scheduling program to run a longer version of the following .m file below with MathKernel. Functions like Complementmake it easy to copy new files from a working directory to a backup directory, and in general, Mathematica makes it easy to use sophisticated logic along with various ...


6

The command Run will do exactly that. For example, try Run["touch ~/Desktop/blankfile"] If you want to read the results back in, there are a few options, and the choice between them depends on exactly what you want to do. The RunThrough command lets you read the output of a command-line back as a Mathematica expression. For example, try ...


5

Here is a minimal example on how to run a mathematica script on a raspberry pi. Create a simple script (I used my bash terminal to do it): echo "sum=1+1; Print[sum]" > test.wl Excecute the script: wolfram -script test.wl 2


5

According to the documentation, To suppress the loading of kernel initialization files, use the kernel command-line option -noinit. To specify another file to be used for kernel initialization in addition to init.m, use the kernel command-line option -initfile file, where file is the additional initialization file.


4

On Windows there are two kernel executables: MathKernel.exe and math.exe. MathKernel.exe has its own input window, which may show up separately when you start the process from a command window. If you run it in MathLink mode, it may still show as a taskbar button. math.exe runs in a standard Windows command window. If you start it from within an existing ...


4

(* make the task, fires once a minute *) task = CreateScheduledTask[PutAppend[MemoryInUse[], "myMemory.log"], 60]; (* start the task *) StartScheduledTask[task] (* ... do your thingys ... *) (* stop (or remove) the task *) StopScheduledTask[task] RemoveScheduledTask[task]


3

Clusters can be significantly different from each other, so I strongly recommend you talk to someone who uses the same system and ask them for help with the details. However, there is one thing that is clearly incorrect in your job script: To run a script with Mathematica, you need to start the kernel (command line program), not the front end (graphical ...


2

For this kind of "logging" in SubKernels for example I use the following code: oldoutput = $Output; (* store $Output *) oldmessages = $Messages; (* same for $Messages *) CheckAbort[ logstream = OpenWrite["yourlog.log"]; $Output = {logstream}; (* redirect $Output *) AppendTo[$Messages, logstream]; (* add the logfile as an additional destination for ...


2

This is not an issue with Mathematica itself. It's related to how you closed the session on the remote machine. If you use screen, you should detach from the current screen session before exiting, otherwise you'll close the current shell together with its child processes, including Mathematica. Alternatively, just use nohup, and do not bother with screen: ...


2

You can solve the issue by wrapping your code with UsingFrontEnd[].


2

This is because your shell doesn't allow background processes to print to the console. For instance tcsh has this behavior by default: % echo "a"& [1] 26502 % [1] + Suspended (tty output) echo a % fg echo a a In pretty much all shells you should be able to disable this behavior with stty -tostop % stty -tostop % echo "a" & [1] 26539 a % ...


2

Mathematica for unknown reasons is waiting for input. Possible solution echo | math -script someFile.m &



Only top voted, non community-wiki answers of a minimum length are eligible