当前位置:Gxlcms >
数据库问题 >
Mac 10.12通过Launchd创建自定义服务(基于MySQL 5.7.15的开机自启动)
Mac 10.12通过Launchd创建自定义服务(基于MySQL 5.7.15的开机自启动)
时间:2021-07-01 10:21:17
帮助过:22人阅读
xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled
</key>
<false/>
<key>ExitTimeOut
</key>
<integer>600
</integer>
<key>GroupName
</key>
<string>_mysql
</string>
<key>KeepAlive
</key>
<true/>
<key>Label
</key>
<string>com.oracle.oss.mysql.mysqld
</string>
<key>LaunchOnlyOnce
</key>
<false/>
<key>ProcessType
</key>
<string>Interactive
</string>
<key>Program
</key>
<string>/usr/local/mysql/bin/mysqld
</string>
<key>ProgramArguments
</key>
<array>
<string>/usr/local/mysql/bin/mysqld
</string>
<string>--user=_mysql
</string>
<string>--basedir=/usr/local/mysql
</string>
<string>--datadir=/usr/local/mysql/data
</string>
<string>--plugin-dir=/usr/local/mysql/lib/plugin
</string>
<string>--log-error=/usr/local/mysql/data/mysqld.local.err
</string>
<string>--pid-file=/usr/local/mysql/data/mysqld.local.pid
</string>
</array>
<key>RunAtLoad
</key>
<true/>
<key>SessionCreate
</key>
<true/>
<key>UserName
</key>
<string>_mysql
</string>
<key>WorkingDirectory
</key>
<string>/usr/local/mysql
</string>
</dict>
</plist>
提示:创建文件可以使用vi命令这些,注意要加上sudo开头。
2、修改权限:
sudo chown root:wheel com.oracle.oss.mysql.mysqld.plist
3、检查语法
sudo plutil -lint com.oracle.oss.mysql.mysqld.plist
4、加载
sudo launchctl load -w com.oracle.oss.mysql.mysqld.plist
提示:这样设置完成之后就可以开机自启动。
5、卸载,取消开机自启动
sudo launchctl unload -w com.oracle.oss.mysql.mysqld.plist
删除com.oracle.oss.mysql.mysqld.plist
参考:
http://blog.csdn.net/lolashe/article/details/41117577
http://squll369.iteye.com/blog/1965185
http://www.cnblogs.com/EasonJim/p/7173859.html(基本服务命令操作)
https://en.wikipedia.org/wiki/Launchd(plist语法参考)
Mac 10.12通过Launchd创建自定义服务(基于MySQL 5.7.15的开机自启动)
标签:dia doctype 操作 启动 ack tar array plist dtd