send mail when machining finished

More
06 Feb 2012 16:01 #17464 by northmeade
send mail when machining finished was created by northmeade
Hi All,
is it possible to automatically send an email when machining has finished, and if so, how would i do it?

cheers, paul

Please Log in or Create an account to join the conversation.

More
06 Feb 2012 16:35 #17467 by ArcEye
Replied by ArcEye on topic Re:send mail when machining finished
Yes,

This thread deals with having a notification when at a particular stage of a program using user M codes

www.linuxcnc.org/index.php/english/compo...=21&id=16878&limit=6

Simply substitute sending an email for displaying a graphic (or playing a sound file)

This gives a basic guide to command line email using sendmail

www.simplehelp.net/2008/12/01/how-to-sen...-linux-command-line/

regards

Please Log in or Create an account to join the conversation.

More
06 Feb 2012 18:22 #17470 by northmeade
Replied by northmeade on topic Re:send mail when machining finished
superb, thanks.
getting Unknown M code used error though when i try to run it???

Please Log in or Create an account to join the conversation.

More
06 Feb 2012 19:56 #17471 by ArcEye
Replied by ArcEye on topic Re:send mail when machining finished
You will need to specify what you did to "..try to run it.."

The file must be executable, in the correct directory, the call is case sensitive and emc must be restarted if open when the file was transferred.

Regards

Please Log in or Create an account to join the conversation.

More
06 Feb 2012 20:36 #17473 by northmeade
Replied by northmeade on topic Re:send mail when machining finished
i've executed the file from the directory so that's ok, case is the same, i'll try restarting emc.
thanks for your help on this i wouldn't know where to start

Please Log in or Create an account to join the conversation.

More
07 Feb 2012 09:13 #17481 by ArcEye
Replied by ArcEye on topic Re:send mail when machining finished
Hi

Just to make sure we are talking about the same thing

All M1xx must be located in the directory set out in your .ini file
eg.
[DISPLAY]
.....
PROGRAM_PREFIX = /home/me/emc2/ngc

If they are not they will not work, but you should get an error to stderr saying the file could not be found.

Next all M1xx files must be executable by all users, ie permissions set at least to 755 and maybe 777 to be ultra sure.
If you try to create file permissions as a user with limited access, that often is the source of the problem.
Log in a root to be sure before using chmod or at least use 'sudo chmod'


Additionally the case sensitivity is slightly strange due I think to emc's conversion of g code to lower case and linux's strict separation of lower and uppercase in file names. I name all my M code files with uppercase M and call them the same way.

For instance if you name a file m112 and call it from the MDI command line with m112 or M112 you often get this error, albeit sometimes m112 will work!
Unknown M code used:
/emc/task/emctask.cc 357: interp_error : Unknown M code used


However if you name it M112 it can be called with m112 or M112 !

regards

Please Log in or Create an account to join the conversation.

More
07 Feb 2012 13:25 #17483 by northmeade
Replied by northmeade on topic Re:send mail when machining finished
got it to work (displaying the image, will sort sending the email this afternooon) just needed to restart. problem im having now is i have put the M112 just before the M30 . It shows the image fine but does not continue on the the M30 line which in need to record the time taken machining.

Please Log in or Create an account to join the conversation.

More
07 Feb 2012 13:28 #17484 by BigJohnT
Replied by BigJohnT on topic Re:send mail when machining finished
The M112 pauses the execution of the g code until you close the window. I seem to recall there is a way around this but not the details this early in the morning.

John

Please Log in or Create an account to join the conversation.

More
07 Feb 2012 16:48 - 07 Feb 2012 16:49 #17492 by northmeade
Replied by northmeade on topic Re:send mail when machining finished
Thanks for all the help on this. Got it working and i find it really useful. stops me having to keep going out to the garage to see if its stopped machining.
I installed postfix and mailx then it just worked fine straight off. The M112 goes above M30 and once it sends the mail the code just carries on to M30.
As ArcEye says, The M112 must be located in the directory set out in your .ini file
eg.
[DISPLAY]
.....
PROGRAM_PREFIX = /home/me/emc2/ngc

Make sure you add the address to your contacts in your normal email client (gmail or hotmail or whatever) or it will be spam filtered

Thanks again, paul

File Attachment:

File Name: M112-f4b08...38f4.zip
File Size:0 KB
Attachments:
Last edit: 07 Feb 2012 16:49 by northmeade.

Please Log in or Create an account to join the conversation.

More
07 Feb 2012 17:57 #17493 by ArcEye
Replied by ArcEye on topic Re:send mail when machining finished
Hi

Glad you got it sorted. As you have found user M codes can be a very flexible and powerful tool.

It shows the image fine but does not continue on the the M30 line which in need to record the time taken machining.

If you wanted to continue immediately having called some command line app via a user M code, just suffix the command with an ampersand so that it is spawned into a background task.
eg
#!/bin/bash

eog ~/emc2/ngc/message.png &

exit 0

regards

Please Log in or Create an account to join the conversation.

Time to create page: 0.100 seconds
Powered by Kunena Forum