@execute for sending Repetier Server events' emails ... doesn't work

Dear 3d friends, I tested nearly everything to send the mails in case of Repetier Server events (ver. 1.2 on RPi Zero), but unsuccessfuly.

1) I installed ssmtp as well as mailutils + I modified smtp server in /etc/ssmtp/ssmtp.conf. From this moment, "echo "Repetier Server Test Mail" | mail -s "Repetier Server Test" a.b@gmail.com" worked well and mails were sent :-).
2) I added following 2 lines into /var/lib/Repetier-Server/database/extcommands.xml:
<execute name="SendPrintTermination" allowParams="false">sudo /var/lib/Repetier-Server/database/sendmailPT.sh</execute><!-- Send mail with print termination message -->
<execute name="SendFilamentChange" allowParams="false">sudo /var/lib/Repetier-Server/database/sendmailFC.sh</execute><!-- Send mail with filament change message -->
3) I created 2 files in /var/lib/Repetier-Server/database/
"sendmailPT.sh" with content
echo "Printing was successfuly terminated!" | mail -s "Repetier Server Print Termination" a.b@gmail.com
and "sendmailFC.sh" with content
echo "Printing was suspended for filament change!" | mail -s "Repetier Server Filament Change" a.b@gmail.com
4) I modified their rights (finally to 777, user repetierserver, group pi) to be executable by everyone (temporary, of course)

Despite these steps mentioned above, using "@execute SendPrintTermination" and "@execute SendFilamentChange" in web console, commands are executed (no error message), but no mail is sent unfortunately.
I tested also "sudo /var/lib/Repetier-Server/database/sendmailPT.sh" and "sudo /var/lib/Repetier-Server/database/sendmailFC.sh" from bash and both work as expected (mails are sent without any obstacle).

Would you be so kind and could you advise me, what is the issue and why the mails are not sent, please?
Thanks in advance, Josef.





Comments

  • edited October 2021
    Finally I solved the issue ... sudo was the reason ... therefore step 2 should be definitively:

    2) Add following 2 lines into /var/lib/Repetier-Server/database/extcommands.xml:
    <execute name="SendPrintTermination" allowParams="false">/var/lib/Repetier-Server/database/sendmailPT.sh</execute><!-- Send mail with print termination message -->
    <execute name="SendFilamentChange" allowParams="false">/var/lib/Repetier-Server/database/sendmailFC.sh</execute><!-- Send mail with filament change message -->

    After that, everything works like a charm.
    Thanks to Repetier Server creators!

  • When you use sudo you need to know that it will be executed as repetierserver user and that user is NOT allowed to sudo every script! You need to add it to /etc/sudoers.d file with permissions.

    Also script should better be placed in /var/lib/Repetier-Server/scripts as that is the designed place and is also used to backup scripts if you do with monitor software.
Sign In or Register to comment.