Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With the use of Start and Stop scripts you can configure Power Scripts to run a script whenever Jira starts or stops. Note that this is assuming that Jira starts/stops correctly. If the server crashes the procedures to shut JVM instance down get skipped. So, if you configure a script to run when Jira starts it tends to be more reliable. If you install Jira to run as a service it will automatically start when the server reboots and the script will run whenever the server crashes and restarts. That is what I used it for anyway, perhaps you have something else in mind. Either way the steps to send the message will be the same.

For a long time SIL had SMS capabilities built directly within it. However, these SMS gateways had to be configured with each service provider. That way has become obsolete now that (just about) every carrier has an email to SMS service that will automatically convert an email to a text message if the email is sent to the right address. Each provider has a different email address but they all basically work the same way. The phone number servers as the username and then each carrier has a unique domain. See a list of some of the most common carriers below.

...

One option would be to use persistent variables. That way the personal information would be a little more out of sight and would not be stored in the script.

Code Block
persistent string [] textUsers;

JEmailMessage email;
email.to = textUsers;
email.subject = "Jira has restarted!";
email.message = "The Jira server has been restarted. Maybe you should check it out?";
 
sendEmail(email);

This method is okay, however, personally I like to build solutions that don’t require the script to me modified in order to maintain them. I also like to keep user data with the user. The way I prefer to do, which admittedly, is a little more involved, is to store the information as a user property.

...

Then the users who whish to receive the text messages can be added to a group. The script will loop through the users in the group and get the emails from the users properties.

Code Block
string [] smsEmails;

for(string user in usersInGroups("SMS Recipients", true)) {
    string email = getUserProperty(user, "SMS Email");
    if(isNotNull(email)) {
        smsEmails += email;
    }
}

JEmailMessage email;
email.to = smsEmails;
email.subject = "Jira has restarted!";
email.message = "The Jira server has been restarted. Maybe you should check it out?";
 
sendEmail(email);

Yes, it is a little more code but in this way a users email can easily be updated in the Jira admin UI and not the script. And, users can easily be added or removed from the user group.