Skip to content

Commit

Permalink
Add support for external command
Browse files Browse the repository at this point in the history
  • Loading branch information
miluxhd committed Dec 7, 2018
1 parent 7c6364e commit edd30d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions etc/otpw/otpw-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ master.password.tmpdir=/home/miluxhd
master.db.password=PASSWORD
master.db.name=otpw
master.db.user=otpwuser
master.messagecommand=/var/lib/otpw/externalScript/sms.sh
10 changes: 9 additions & 1 deletion java/src/main/java/ir/milux/MessageSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

import org.apache.log4j.Logger;

import java.io.IOException;

public class MessageSender {
Logger logger = Logger.getLogger (MessageRequest.class);
public void send(String id,String password){
logger.info ("id : " + id + "password : " + password);
Runtime runtime = Runtime.getRuntime ();
String messageCommand = Properties.getProperty ("master.messagecommand") +" '" + id + "' '" + password+"'";
try {
runtime.exec (messageCommand);
} catch (IOException e) {
logger.error (e.getMessage ());
}
}
}

0 comments on commit edd30d0

Please sign in to comment.