Add launch service

This commit is contained in:
chenbaiyu
2022-01-13 19:23:41 +08:00
parent f45a2c7a94
commit 9be6b17a8b
9 changed files with 204 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
<?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>Disable<key>
<false />
<key>Label</key>
<string>com.carriez.rustdesk.agent.root</string>
<key>LimitLoadToSessionType</key>
<array>
<string>LoginWindow</string>
</array>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false />
<key>AfterInitialDemand</key>
<false />
</dict>
<key>RunAtLoad</key>
<true />
<key>ProgramArguments</key>
<array>
<string>/Applications/RustDesk.app/Contents/MacOS/rustdesk</string>
<string>--server</string>
</array>
<key>WorkingDirectory</key>
<string>/Applications/RustDesk.app/Contents/MacOS/</string>
</dict>
</plist>

View File

@@ -0,0 +1,30 @@
<?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>Disable<key>
<false />
<key>Label</key>
<string>com.carriez.rustdesk.agent.root</string>
<key>LimitLoadToSessionType</key>
<array>
<string>Aqua</string>
</array>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false />
<key>AfterInitialDemand</key>
<false />
</dict>
<key>RunAtLoad</key>
<true />
<key>ProgramArguments</key>
<array>
<string>/Applications/RustDesk.app/Contents/MacOS/rustdesk</string>
<string>--server</string>
</array>
<key>WorkingDirectory</key>
<string>/Applications/RustDesk.app/Contents/MacOS/</string>
</dict>
</plist>

View File

@@ -0,0 +1,23 @@
<?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>Label</key>
<string>com.carriez.rustdesk.daemon</string>
<key>Disabled</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.youqu.todesk.service</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/RustDesk.app/Contents/MacOS/rustdesk</string>
<string>--daemon</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/Applications/RustDesk.app/Contents/MacOS/</string>
</dict>
</plist>

View File

@@ -0,0 +1,9 @@
set current_dir to POSIX path of ((path to me as text) & "::")
set sh1 to "cp " & current_dir & "com.carriez.rustdesk.daemon.plist /Library/LaunchDaemons/com.carriez.rustdesk.daemon.plist && chown root:wheel /Library/LaunchDaemons/com.carriez.rustdesk.daemon.plist"
set sh2 to "cp " & current_dir & "com.carriez.rustdesk.agent.root.plist /Library/LaunchAgents/com.carriez.rustdesk.agent.root.plist && chown root:wheel /Library/LaunchAgents/com.carriez.rustdesk.agent.root.plist"
set sh3 to "cp " & current_dir & "com.carriez.rustdesk.agent.user.plist /Library/LaunchAgents/com.carriez.rustdesk.agent.user.plist && chown root:wheel /Library/LaunchAgents/com.carriez.rustdesk.agent.user.plist"
set sh to sh1 & ";" & sh2 & ";" & sh3
do shell script sh with prompt "RustDesk需要安装服务plist" with administrator privileges

View File

@@ -0,0 +1,10 @@
set sh to "
launchctl enable system/com.carriez.rustdesk.daemon;
launchctl start system/com.carriez.rustdesk.daemon;
launchctl enable system/com.carriez.rustdesk.agent.root;
launchctl start system/com.carriez.rustdesk.agent.root;
launchctl enable system/com.carriez.rustdesk.agent.user
launchctl start system/com.carriez.rustdesk.agent.user
"
do shell script sh with prompt "RustDesk需要启动服务" with administrator privileges

View File

@@ -0,0 +1,10 @@
set sh to "
launchctl disable system/com.carriez.rustdesk.daemon;
launchctl stop system/com.carriez.rustdesk.daemon;
launchctl disable system/com.carriez.rustdesk.agent.root;
launchctl stop system/com.carriez.rustdesk.agent.root;
launchctl disable system/com.carriez.rustdesk.agent.user
launchctl stop system/com.carriez.rustdesk.agent.user
"
do shell script sh with prompt "RustDesk需要停止服务" with administrator privileges