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.
The Monitoring Script
#!/bin/bash
if [ ! $(ps axo pid,command | grep "[G]oogle Drive.app") ]]; then
open -a Google\ Drive.app
else
echo "Running"
fiAs 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.
Intgrating Email Notifications
SGTO="someone@somesone.com"
SGTONAME='Your Name'
SGSUBJECT='Google Drive just quit!'
SGFROM=youremail@youremail.com
SGTEXT='The Google Drive app just quit, it was relaunched. Just letting you know.'
SGUSER=<Your Sendgrid Username>
SGPASS='<Your Sendgrid Password>'
curl -d "to=${SGTO}&toname=${SGTONAME}&subject=${SGSUBJECT}&text=${SGTEXT}&from=${SGFROM}&api_user=${SGUSER}&api_key=${SGPASS}" https://api.sendgrid.com/api/mail.send.jsonAs 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.
#!/bin/bash
if [ ! $(ps axo pid,command | grep "[G]oogle Drive.app") ]]; then
open -a Google\ Drive.app
SGTO="someone@somesone.com"
SGTONAME='Your Name'
SGSUBJECT='Google Drive just quit!'
SGFROM=youremail@youremail.com
SGTEXT='The Google Drive app just quit, it was relaunched. Just letting you know.'
SGUSER=<Your Sendgrid Username>
SGPASS='<Your Sendgrid Password>'
curl -d "to=${SGTO}&toname=${SGTONAME}&subject=${SGSUBJECT}&text=${SGTEXT}&from=${SGFROM}&api_user=${SGUSER}&api_key=${SGPASS}" https://api.sendgrid.com/api/mail.send.json
else
echo "Running"
fiAs you can see the email notifications will only trigger if the app needs to be re-launched.
Schedule the task
To install this simply copy the script to a file on your server. My favorite method for doing this is using touch.
bash-3.2$ touch /location/of/where/you/want/the/script/myscript.shOnce done, change the permissions on the file to allow it to execute.
bash-3.2$ chmod 777 /location/of/where/you/want/the/script/myscript.shTo schedule this setup a CRON JOB on your server by running these commands
bash-3.2$ crontab -eOnce you enter into the cron editor add this line and then save the file.
0 * * * * /bin/bash /location/of/where/you/want/the/script/myscript.shRemember to change the path and the name of the script to match your actual script.
Conclusion
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.
AI Usage Transparency Report
Pre-AI Era · Written before widespread use of generative AI tools
AI Signal Composition
Score: 0.05 · Low AI Influence
Summary
A script to monitor and restart apps on a Mac, with email notifications via SendGrid.
Related Posts
Leaving Flickr: Migrating 20,000+ Photos to Synology and Taking Back Control
There’s a certain kind of friction you start to notice when you’ve been using a service for a long time. Not enough to make you leave immediately, but enough to make you pause. Flickr had been that kind of service for me. It quietly held years of photos, uploads from old phones, albums I hadn’t looked at in ages, and a massive "Auto Upload" collection that had grown into something I didn’t fully understand anymore.
How I Finally Passed the PMP Exam (After 12 Years of Waiting)
Back in 2013, I registered for a PMI membership with every intention of pursuing my PMP certification. I downloaded the handbook, bookmarked the eligibility requirements, and even told a few friends that I was going to do it "soon." At the time, I thought getting certified would be a straightforward process, but little did I know what lay ahead in terms of studying and preparation.
10 Things You Didn't Know You Could Do With Apple Configurator (That Save Mac Admins Hours)
Most of us treat Apple Configurator like a fire extinguisher: break glass, DFU, restore, move on. But it can do a lot more, and when you know the edges, you can turn a bricked morning into a ship-it afternoon. Below are ten things I regularly use (or wish I’d used sooner) that demonstrate its capabilities beyond just emergency recovery.
The Evolution of Apple Certification: A Journey Through Versions, Challenges & Growth
When I recently passed the Apple Certified Support Professional (ACSP) exam again, I paused to reflect — not just on this milestone, but on the long path I’ve walked through Apple’s certification landscape. My first certification dates back to macOS 10.5, and over the years, I’ve earned credentials across nearly every version since. In that time, the exams — and Apple itself — have transformed significantly.
Secure Software, Secure Career: How I Passed the CSSLP
After passing the CISSP earlier this year, I decided to follow it up with the **Certified Secure Software Lifecycle Professional (CSSLP)** certification. For those unfamiliar, CSSLP is an ISC2 certification that focuses specifically on secure software development practices across the full SDLC—from requirements and design to coding, testing, deployment, and maintenance. My goal in pursuing this certification was to further develop my skills in ensuring the security of software throughout its entire lifecycle.
Managing Bring Your Own Device (BYOD) for Android with Microsoft Intune
Alright, so today we're going to be talking about the management of bring your own device BYOD for Android devices. There's a lot of information out there for the management of iOS devices and you can do that with pretty much any Apple MDM on the market. We just happen to use Jamf where I work, but you could use anything from Braavos to SimpleMDM to Kanji or JumpCloud. Mosyle is also a great option.
BYO with me in 2025: iOS with User Enrollment in JAMF Pro
It really depends on your company's needs. For example, many companies need to hire 1099 contractors and in such a case they come with their own devices but not the correct security settings or enforcements. Remember BYOD is a security construct. The idea here is that you should be securing the company's sensitive data in all forms. This may involve implementing policies for contractor-owned devices, ensuring that all devices accessing company data meet minimum security standards, and regularly reviewing and updating these standards to stay ahead of emerging threats.
Securing BYOD Email Access: Exploring Strategies in Microsoft 365
In today’s mobile-first world, organizations increasingly rely on Bring Your Own Device (BYOD) programs to empower employees while optimizing costs. However, this flexibility introduces unique challenges, particularly around securing email access. To mitigate risks, we are implementing a comprehensive strategy to block email access on non-company devices by default and ensure only sanctioned apps can access organizational email accounts. This approach will help prevent unauthorized access and data breaches, aligning with our commitment to maintaining the security and integrity of company communications.
How I Conquered the CISSP Exam: 9 Months, Top Resources, and Proven Strategies
Passing the CISSP (Certified Information Systems Security Professional) exam is no small feat. It’s known for its breadth, depth, and ability to test not just your knowledge but your practical understanding of cybersecurity. After nine months of intense preparation, I’m thrilled to say I’ve joined the ranks of CISSP-certified professionals! Here's a detailed account of my experience, including the resources I used, some tips that helped me along the way, and what I learned from the process itself.
Get more out of scripting than you may expect
Expect is an extension to the Tcl scripting language written by Don Libes. The program automates interactions with programs that expose a text terminal interface. Expect, originally written in 1990 for the Unix platform, has since become available for Microsoft Windows and other systems. Its functionality allows users to interact with these programs through scripted commands, eliminating the need for manual input.