Skip to main content
replaced http://apple.stackexchange.com/ with https://apple.stackexchange.com/
Source Link

The idea is that when somebody logs in to my Mac, a popup will show up and the date/time are written to a log.

I run the bash script from a cron job:

 @reboot ~/Develop/login.sh 

(I know about launchd but choose to use cron, much easier)

the login.sh script:

#!/bin/bash
osascript <<EOD
  tell application "System Events"
  activate
  display dialog "Unauthorized Login" buttons {"OK"} default button 1 with icon caution with title "WARNING!"
  end tell
EOD

echo "$(date) LogIn Alert" >> ~/Develop/login.log

I can execute the script with ./login.sh. All working well, the dialog is shown and login time is written to the log.

But when restarting my Mac the login date/time is written to the file (so the cron job is working), but the dialog is not popping up.

(I did look at the question Run AppleScript from bash scriptRun AppleScript from bash script)

So my question is how to show this dialog when rebooting my Mac? (macOS 10.12.3)

The idea is that when somebody logs in to my Mac, a popup will show up and the date/time are written to a log.

I run the bash script from a cron job:

 @reboot ~/Develop/login.sh 

(I know about launchd but choose to use cron, much easier)

the login.sh script:

#!/bin/bash
osascript <<EOD
  tell application "System Events"
  activate
  display dialog "Unauthorized Login" buttons {"OK"} default button 1 with icon caution with title "WARNING!"
  end tell
EOD

echo "$(date) LogIn Alert" >> ~/Develop/login.log

I can execute the script with ./login.sh. All working well, the dialog is shown and login time is written to the log.

But when restarting my Mac the login date/time is written to the file (so the cron job is working), but the dialog is not popping up.

(I did look at the question Run AppleScript from bash script)

So my question is how to show this dialog when rebooting my Mac? (macOS 10.12.3)

The idea is that when somebody logs in to my Mac, a popup will show up and the date/time are written to a log.

I run the bash script from a cron job:

 @reboot ~/Develop/login.sh 

(I know about launchd but choose to use cron, much easier)

the login.sh script:

#!/bin/bash
osascript <<EOD
  tell application "System Events"
  activate
  display dialog "Unauthorized Login" buttons {"OK"} default button 1 with icon caution with title "WARNING!"
  end tell
EOD

echo "$(date) LogIn Alert" >> ~/Develop/login.log

I can execute the script with ./login.sh. All working well, the dialog is shown and login time is written to the log.

But when restarting my Mac the login date/time is written to the file (so the cron job is working), but the dialog is not popping up.

(I did look at the question Run AppleScript from bash script)

So my question is how to show this dialog when rebooting my Mac? (macOS 10.12.3)

edited title
Link
Allan
  • 106k
  • 33
  • 217
  • 499

Show dialog at rebootlogin (bash script)

MAC and Mac are two totally different things....
Source Link
Allan
  • 106k
  • 33
  • 217
  • 499

Show dialog at MAC reboot (bash script)

The idea is that when somebody logs in to my MACMac, a popup will show up and the date/time are written to a log.

I run the bash script from a cron job:

 @reboot ~/Develop/login.sh 

(I know about launchd but choose to use cron, much easier)

the login.sh script:

#!/bin/bash
osascript <<EOD
  tell application "System Events"
  activate
  display dialog "Unauthorized Login" buttons {"OK"} default button 1 with icon caution with title "WARNING!"
  end tell
EOD

echo "$(date) LogIn Alert" >> ~/Develop/login.log

I can execute the script with ./login.sh. All working well, the dialog is shown and login time is written to the log.

But when restarting my Mac the login date/time is written to the file (so the cron job is working), but the dialog is not popping up.

(I did look at the question Run AppleScript from bash script)

So my question is how to show this dialog when rebooting my MACMac? (macOS 10.12.3)

Show dialog at MAC reboot (bash script)

The idea is that when somebody logs in to my MAC a popup will show up and the date/time are written to a log.

I run the bash script from a cron job:

 @reboot ~/Develop/login.sh 

(I know about launchd but choose to use cron, much easier)

the login.sh script:

#!/bin/bash
osascript <<EOD
  tell application "System Events"
  activate
  display dialog "Unauthorized Login" buttons {"OK"} default button 1 with icon caution with title "WARNING!"
  end tell
EOD

echo "$(date) LogIn Alert" >> ~/Develop/login.log

I can execute the script with ./login.sh. All working well, the dialog is shown and login time is written to the log.

But when restarting my Mac the login date/time is written to the file (so the cron job is working), but the dialog is not popping up.

(I did look at the question Run AppleScript from bash script)

So my question is how to show this dialog when rebooting my MAC? (macOS 10.12.3)

Show dialog at reboot (bash script)

The idea is that when somebody logs in to my Mac, a popup will show up and the date/time are written to a log.

I run the bash script from a cron job:

 @reboot ~/Develop/login.sh 

(I know about launchd but choose to use cron, much easier)

the login.sh script:

#!/bin/bash
osascript <<EOD
  tell application "System Events"
  activate
  display dialog "Unauthorized Login" buttons {"OK"} default button 1 with icon caution with title "WARNING!"
  end tell
EOD

echo "$(date) LogIn Alert" >> ~/Develop/login.log

I can execute the script with ./login.sh. All working well, the dialog is shown and login time is written to the log.

But when restarting my Mac the login date/time is written to the file (so the cron job is working), but the dialog is not popping up.

(I did look at the question Run AppleScript from bash script)

So my question is how to show this dialog when rebooting my Mac? (macOS 10.12.3)

Source Link
Mick dK
  • 123
  • 6
Loading