We have all had that moment where you save and save your files into your Google drive folder only to find out that days prior the Google Drive app had somehow stopped sycing your files. You need to get a file from Google Drive because your computer’s battery is dead and the files are not in the cloud.
This is a more common problem then you might think. If its not Google Drive it could be another app that you rely on. Dashlane, LastPass, and Crashplan are other great examples of programs that you would expect would stay running behind the scenes on your computer.
Imagine being able to be notified when a program isnt running. Better yet be notified via email. You can sign up for a free SendGrid account and use that to relay mail. Here is how you do it. In the script below change the name of the app to the app you want to monitor.
Configure the API key and other information from your SendGrid account and setup a cron task. Lets dive deeper.
As you can see this part of the script runs and checks if Google Drive is running. If its running it says “Running” if it doesnt then it opens the Google Drive program. This is great for those pesky apps that just seem to quit all the time.
As you can see configuring email via a script is as easy as signing up for a free SendGrid account and configuring the above variables. The 2 that are important are the SGUSER which is your SendGrid username and your SGPASS which is yoru SendGrid password.
You will want to install this script inside the loop like this.
As you can see the email notifications will only trigger if the app needs to be re-launched.
To install this simply copy the script to a file on your server. My favorite method for doing this is using touch.
Once done, change the permissions on the file to allow it to execute.
To schedule this setup a CRON JOB on your server by running these commands
Once you enter into the cron editor add this line and then save the file.
Remember to change the path and the name of the script to match your actual script.
Until apps become more reliable especially the ones that we need to make sure are always running this little script makes a handy tool that you can leave running on your Mac. Whenever an app you care about crashes it will automatically re-open on the schedule that you set via cron.
Copyright © MAC GURUS LLC. All Rights Reserved.