Close the terminal but keep Macaulay2 running remotely

29 views
Skip to first unread message

huangh...@gmail.com

unread,
Apr 27, 2021, 8:19:55 PM4/27/21
to Macaulay2
Hi everyone,

I have to run some programs remotely in a cluster.
The problem is the following, the programs run for two or three days (they are really heavy). I connect to the cluster and run the programs using terminal.
The program runs properly, but if I close the terminal the program stops running, and if I disconnect from the network the program give me error.
Is there any way that I can run the program and I can disconnect or close the terminal and the program keep running?
Any suggestion will be greatly appreciated. Thank you very much!

mike stillman

unread,
Apr 27, 2021, 8:46:10 PM4/27/21
to Macaulay2
Two command line programs that are useful (and are doing similar things) for this are 'screen', and 'tmux' (on unix, linux, mac, probably windows using ubuntu).  I always use one of these when I connect up to a server, and start a computation running.

Best,

Mike

Vinay Wagh

unread,
Apr 28, 2021, 2:58:48 AM4/28/21
to Macaulay2
In addition to what Mike has suggested, I would like to add:

If you are over an unstable network or keep switching between networks, then use mosh, instead of ssh. You can start the mosh connection in a screen/byobu/tmux terminal.

For more details on mosh:


Hope this helps.

-- VInay


--
You received this message because you are subscribed to the Google Groups "Macaulay2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to macaulay2+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/macaulay2/fcb73821-a578-4ec8-8367-d1c53d2393ddn%40googlegroups.com.

Fabio Tanturri

unread,
Apr 28, 2021, 3:33:17 AM4/28/21
to maca...@googlegroups.com
Hi,
I am not familiar with screen and/or tmux, so let me add a question. Is there an easy way to execute an .m2 file and ask the terminal to give me a warning whenever the process stops, e.g., if M2 runs out of memory or the file hits the quit() command? This way I don't have to periodically check it.
I managed to teach M2 to send me a push notification on my smartphone if some conditions are met, but if M2 itself stops then I did not find a way to do that. I admit I am not at all an expert with terminals.

Also, thanks for the screen/tmux suggestion! I have always been using the nohup command, which lets you run an .m2 file without a terminal showing the output. But then you have to prepare the .m2 file in order for it to save the output in some separate output file, so I realise it's not the best solution.

Best,
Fabio

Thomas Kahle

unread,
Apr 28, 2021, 4:00:59 AM4/28/21
to maca...@googlegroups.com
Hi,

If mail is properly configured on the machine you could send yourself an e-mail when M2 exits. Just put the M2 command next to something like

mail -a /macaulay2/output/file/to/attach.out -s "Put down your cocktail, M2 is done!" m2u...@gmail.com < /dev/null

which will send you an empty text e-mail with the given attachment and subject to m2u...@mail.com.

There are also services which push notifications to your smartphone.
A cool app is https://pushover.net which you can trigger by
sending a message to their server. So this should work from any
machine that's connected to the Internet and can run curl or python.

Cheers,
Thomas


On 28 Apr 2021, at 9:33, Fabio Tanturri wrote:

> Hi,
> I am not familiar with screen and/or tmux, so let me add a question. Is there an easy way to execute an .m2 file and ask the terminal to give me a warning whenever the process stops, e.g., if M2 runs out of memory or the file hits the quit() command? This way I don't have to periodically check it.
> I managed to teach M2 to send me a push notification on my smartphone if some conditions are met, but if M2 itself stops then I did not find a way to do that. I admit I am not at all an expert with terminals.
>
> Also, thanks for the screen/tmux suggestion! I have always been using the nohup command, which lets you run an .m2 file without a terminal showing the output. But then you have to prepare the .m2 file in order for it to save the output in some separate output file, so I realise it's not the best solution.
>
> Best,
> Fabio
>
> On 28/04/2021 08:58, Vinay Wagh wrote:
>> In addition to what Mike has suggested, I would like to add:
>>
>> If you are over an unstable network or keep switching between networks, then use *mosh*, instead of ssh. You can start the mosh connection in a screen/byobu/tmux terminal.
>>
>> For more details on mosh:
>> https://mosh.org/ <https://mosh.org/>
>>
>>
>> Hope this helps.
>>
>> -- VInay
>>
>>
>> On Wed, 28 Apr 2021 at 06:16, mike stillman <mikest...@gmail.com <mailto:mikest...@gmail.com>> wrote:
>>
>> Two command line programs that are useful (and are doing similar
>> things) for this are 'screen', and 'tmux' (on unix, linux, mac,
>> probably windows using ubuntu).  I always use one of these when I
>> connect up to a server, and start a computation running.
>>
>> Best,
>>
>> Mike
>>
>> On Tuesday, April 27, 2021 at 8:19:55 PM UTC-4 huangh...@gmail.com
>> <mailto:huangh...@gmail.com> wrote:
>>
>> Hi everyone,
>>
>> I have to run some programs remotely in a cluster.
>> The problem is the following, the programs run for two or
>> three days (they are really heavy). I connect to the cluster
>> and run the programs using terminal.
>> The program runs properly, but if I close the terminal the
>> program stops running, and if I disconnect from the network
>> the program give me error.
>> Is there any way that I can run the program and I can
>> disconnect or close the terminal and the program keep running?
>> Any suggestion will be greatly appreciated. Thank you very much!
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Macaulay2" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to macaulay2+...@googlegroups.com
>> <mailto:macaulay2+...@googlegroups.com> .
>> <https://groups.google.com/d/msgid/macaulay2/fcb73821-a578-4ec8-8367-d1c53d2393ddn%40googlegroups.com?utm_medium=email&utm_source=footer> .
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Macaulay2" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to macaulay2+...@googlegroups.com <mailto:macaulay2+...@googlegroups.com> .
>> To view this discussion on the web visit https://groups.google.com/d/msgid/macaulay2/CAFvOzyHSiVQucvHCoKwZSkBxnP%3DUG98apOp3_hph3w14-K4Wwg%40mail.gmail.com <https://groups.google.com/d/msgid/macaulay2/CAFvOzyHSiVQucvHCoKwZSkBxnP%3DUG98apOp3_hph3w14-K4Wwg%40mail.gmail.com?utm_medium=email&utm_source=footer> .
>
> --
> You received this message because you are subscribed to the Google Groups "Macaulay2" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to macaulay2+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/macaulay2/402e3661-23c9-bdfb-3dbc-d0c497b59a91%40gmail.com.


--
Thomas Kahle
https://www.thomas-kahle.de
signature.asc
Reply all
Reply to author
Forward
0 new messages