วันอังคาร, กรกฎาคม 26, 2548

Mac OS X Login Hook and Logout Hook

เวลาต้องการรัน startup สคริปต์ตอนล็อกอิน หรือ ล็อกเอาท์ใน
MacOS X มี ระบบซึ่งเรียกว่า Login Hook และ Logout Hook
อ้างอิงจากอันนี้ดีที่สุด หน้านี้ และ หน้านี้
วิธีใหม่
sudo defaults write com.apple.loginwindow LoginHook /path/to/script

(where /path/to/script is the full path to the script that you want to execute when a user logs in—it doesn't have to be in the user's Home directory).

This modifies the /var/root/Library/Preferences/com.apple.loginwindow file.


วิธีเก่า
หลักๆแล้วก็คือ แก้ /private/etc/ttys โดยเพิ่ม
-LoginHook /private/mydir/myLoginHookScript -LogoutHook /private/mydir/myLogoutHookScript

เพิ่มระหว่าง console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow
-LoginHook /private/mydir/myLoginHookScript -LogoutHook /private/mydir/myLogoutHookScript vt100 on secure windows=...

ไม่มีความคิดเห็น: