How to execute some script on once user logged in
Опубликовано вт, 12/26/2017 - 17:19 пользователем MaximHi everyone!
Today I'm going on to talk about how to execute some script on once user logged in.
The full instruction is seporated to three main steps:
- Create executor
- add the executor to user's login items
- enable auto login after reboot/turn on a mac.
1. Create executor:
- Open Automator (if you don know where is it just type Automator in the search field).
- Choose Application
- Select Library item at the left.
- Type "Run Shell Script" in the search field of middle part of the window.
- Double click to Run Shell Script in search results
- Add any script you want to execute on once user logged in. The script should be added in the right part of the window.
- Click run to check if everything is ok.
- Save as application (Click save and chose file format as Application).
2. Add the executor to user's login items:
- Open system preferences
- Click to Users & Groups
- Choose necessary user
- At the right side of window go to Login items tab.
- Add aplication which was created in the first step.
3. Enable auto login after reboot/turn on a mac.
- In the Users & Groups window select Login Options
- Unlock preferences if needed.
- Choose necessary user name in the Automatic login drop down list and type password.
- Close preferences window.
Now you can reboot mac and make sure the script starts always on once user logged in.
Enjoy. Have a good day!
See:
How to configure STF cluster and add the sh script for autostart STF