Re: batch mode mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg5655] Re: [mg5641] batch mode mathematica*From*: Mario Sancho Graca <M.S.Graca at Warwick.ac.uk>*Date*: Sat, 4 Jan 1997 22:56:47 -0500*Organization*: University of Warwick*Sender*: owner-wri-mathgroup at wolfram.com

Peter wrote: > > hi there > > i'm on a sun machine running sunos 4.*. > > is it possible to give mathematica command line instructions? something > like: > > math << 'Plot[ Sin[x], {x,0,2*Pi} ]' > > if so, can i put it in the background and save the output to a file? > > nohup math << 'Plot[ Sin[x], {x,0,2*Pi} ]' > save_file & > > thanks! > peter > > -- > You can sum some of the series some of the time, > But you can't sum all of the series all of the time. > -=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=- > I BOYCOTT ANY COMPANY THAT USES MASS ADVERTISING ON THE INTERNET To run Mathematica on the background I use the following procedure. The aim is to start Mathematica at a specific time, run Mathematica commands which are stored in a file, store the results in another file, then exit Mathematica. The procedure has nothing to do with Mathematica itself, but with the Unix operating system. In other words, the same can be done to any application. The Unix 'at hhmm' command starts off a process at military time hhmm. The construct ends with ^D (Control key + D). The construct '<< eof ... eof' tells the shell that the commands are input for Mathematica rather than for the shell itself. A working code is as follows. Suppose that at 4.15 pm we want Mathematica do run the code in file 'MathRemoteCode.txt', store the results of the computations (a list) in file 'computedList1645010297' and finally exit. 'at' command ------------ at 1645 math << eof <<MathRemoteCode.txt Exit[ ] eof ^D contents of 'MathRemoteCode.txt' -------------------------------- Table[ Random[ ], {10} ] >> computedList1645010297 contents of 'computedList1645010297' ------------------------------------ {0.2165258208963744, 0.4787984041170798, 0.6907162037992087, 0.99395320442717, 0.0887044807992424, 0.5125555633332101, 0.97840724468237, 0.4060014270165736, 0.481372399489035, 0.2925335958104831} Regards, -- Mario Sancho Graca University of Warwick Department of Engineering Coventry CV4 7AL United Kingdom Email: M.S.Graca at Warwick.ac.uk