How start a plugin as a service within Mattermost
-
wrote on Dec 2, 2021, 5:09 PM last edited by
Good evening,
how can I start for example mail2most (send Mails to Mattermost) as a service within the app? I can run once in the terminal, but when I close the terminal it shutdown the plugin.
Can I install it as normal service?
-
Aren't mattermost server plugins automatically started by mattermost itself as a child process - https://developers.mattermost.com/integrate/plugins/server/ ?
-
Ah, I see, looks like mail2man is not a plugin, it is some sort of service that is run in the background?
A 'hack' is to have a cron task run every 5 minutes or so to start the service - https://docs.cloudron.io/apps/#cron . Add a script like https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/
-
Ah, I see, looks like mail2man is not a plugin, it is some sort of service that is run in the background?
A 'hack' is to have a cron task run every 5 minutes or so to start the service - https://docs.cloudron.io/apps/#cron . Add a script like https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/
-
@girish that works well, but I have implemented it differently.
Every five minutes runs the programm and send to Mattermost my mails from different inboxes.
Thanks for help!
-
@roru2k20 Would you mind posting your script so others can find it later? A bit of a how-to as this thread suggests
wrote on Dec 7, 2021, 5:29 AM last edited by@robi oh yeah of course, but it is very easy and and I could have actually thought of it myself.
#!/bin/bash cd /app/data/plugins/mail2most ./mail2most -c ./mail2most.conf
This script runs with cron every five minutes to check my mails and send them to the different channels. I have 5 addresses configured and it works fine.