This program runs a process, then notifies the user by SMS using Twilio.
- If you do not have a Twilio account and Twilio phone number, you will need to set one up here: https://www.twilio.com/docs/usage/tutorials/how-to-use-your-free-trial-account
- Clone this repository and navigate to the project directory.
- Run
./setup.sh
. This createsprocessNotify.env
, which configures the secure account information, establishes a python virtual environment, installs the requirements in the virtual environment, and sets up run_process.py to use the virtual environment. - Open
processNotify.env
with your favorite text editor, and replace the bracketed sections with your specific information (found here if you log in: https://www.twilio.com/console). A sampleprocessNotify.env
file may look like:
TWILIO_ACCOUNT_SID=ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWILIO_AUTH_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWILIO_PHONE=+12340000000
MY_PHONE=+12340000001
- (Optional) To allow script to run from anywhere on Mac, type
source set_path.sh
. Warning: moving around the project directory afterwards may break this setup.
Use these steps if you did not complete the optional setup section.
- Navigate to the processNotify repository and activate the virtual environment with
source env/bin/activate
. - Run the command:
python3 run_process.py [command]
. After the command finishes, you should receive a text. [command]
can be replaced with any command and its arguments. For example, I could type:python3 run_process.py ls folder1 folder2
. This would run the commandls folder1 folder2
, then send a text message when the process has finished. You may need to use complicated relative paths.
Use these steps if you completed the optional setup section.
- Type
run_process.py [command]
from anywhere. This will run the command in command from the current working directory, then send a text when complete.