Run shell scripts during Mac and system startup.

Source: Internet
Author: User

MAC system startup process

See:

Http://hi.baidu.com/%CB%E6%B7%E7%B6%F8%D0%D01999/blog/item/271d20a694d7d49dd0435842.html

 

1 MAC boot STARTUP script or application (run shell script when the system starts)

1) if you want to start a Mac application (XXX. APP), you can set it on a graphical interface:

System prefernce --> accounts --> logitems --> Add

 

2) Place the shell or application to the/labrary/startupitems/directory.

3) Create the/etc/rc. Local file and write the script in the file.

4) if you only start the shell program, there is another way, the general process is like this.

A) Set terminate to start at startup. In this way, the shell can be automatically run when the system starts.

B) create or modify ". Profile" in the user directory ". When the shell is started, run the ". Profile" file first.

C) Call the shell script to be executed in ". Profile ".

5) apply Mac launchd, see: http://cb.esast.com/cb/wiki/10020

 

Apple's security check: when using the method 2 and 3 mentioned above, you must set the user ID and group ID of the file, as well as the running permission of the file. The specific method is described below.

 

After the configuration is complete, you can use systemstarter on the terminal to debug the configuration information.

Command: systemstarter-n-d

You can view the configuration issues as prompted.

 

 

2. Solve the "insecure startup Item disabled. error"

You can put the shell to be started in the/labrary/startupitems/directory.

You must change the user ID and group ID of the file and set the permission to 755.

Sudo chown-r root: wheel/library/startupitems/xxx

Sudo chmod-r 755/library/startupitems/xxx

(If you are running a shell file, you do not need to add the-r option to the command)

 

 

Note: Environment Variable issues.

 

Of course, you must refer to Apple's developer documentation:

Introduction to System Startup Programming Topics

Http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/BPSystemStartup.html#//apple_ref/doc/uid/10000172-SW1

MAC system startup process

See:

Http://hi.baidu.com/%CB%E6%B7%E7%B6%F8%D0%D01999/blog/item/271d20a694d7d49dd0435842.html

 

1 MAC boot STARTUP script or application (run shell script when the system starts)

1) if you want to start a Mac application (XXX. APP), you can set it on a graphical interface:

System prefernce --> accounts --> logitems --> Add

 

2) Place the shell or application to the/labrary/startupitems/directory.

3) Create the/etc/rc. Local file and write the script in the file.

4) if you only start the shell program, there is another way, the general process is like this.

A) Set terminate to start at startup. In this way, the shell can be automatically run when the system starts.

B) create or modify ". Profile" in the user directory ". When the shell is started, run the ". Profile" file first.

C) Call the shell script to be executed in ". Profile ".

5) apply Mac launchd, see: http://cb.esast.com/cb/wiki/10020

 

Apple's security check: when using the method 2 and 3 mentioned above, you must set the user ID and group ID of the file, as well as the running permission of the file. The specific method is described below.

 

After the configuration is complete, you can use systemstarter on the terminal to debug the configuration information.

Command: systemstarter-n-d

You can view the configuration issues as prompted.

 

 

2. Solve the "insecure startup Item disabled. error"

You can put the shell to be started in the/labrary/startupitems/directory.

You must change the user ID and group ID of the file and set the permission to 755.

Sudo chown-r root: wheel/library/startupitems/xxx

Sudo chmod-r 755/library/startupitems/xxx

(If you are running a shell file, you do not need to add the-r option to the command)

 

 

Note: Environment Variable issues.

 

Of course, you must refer to Apple's developer documentation:

Introduction to System Startup Programming Topics

Http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/BPSystemStartup.html#//apple_ref/doc/uid/10000172-SW1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.