coreaudiodの再起動
coreaudiod再起動.zsh
サンプルコード
サンプルソース(参考)| 行番号 | ソース |
|---|
| 001 | #!/bin/zsh |
|---|
| 002 | # coding: utf-8 |
|---|
| 003 | #set -x |
|---|
| 004 | #export PATH=/usr/bin:/bin:/usr/sbin:/sbin |
|---|
| 005 | #com.cocolog-nifty.quicktimer.icefloe |
|---|
| 006 | |
|---|
| 007 | #OSのバージョン取得 |
|---|
| 008 | STR_OS_VER=$(/usr/bin/sw_vers -productVersion | /usr/bin/cut -d. -f1,2) |
|---|
| 009 | autoload is-at-least |
|---|
| 010 | /bin/echo "OS:${STR_OS_VER}" |
|---|
| 011 | |
|---|
| 012 | #OSのバージョンで処理を分岐 |
|---|
| 013 | if is-at-least 14.4 "${STR_OS_VER}"; then |
|---|
| 014 | /bin/launchctl kickstart -kp system/com.apple.audio.coreaudiod |
|---|
| 015 | sleep 5 |
|---|
| 016 | fi |
|---|
| 017 | |
|---|
| 018 | #OSのバージョンで処理を分岐 |
|---|
| 019 | if is-at-least 14.6 "${STR_OS_VER}"; then |
|---|
| 020 | /usr/bin/killall coreaudiod |
|---|
| 021 | sleep 5 |
|---|
| 022 | /usr/bin/killall coreaudiod |
|---|
| 023 | else |
|---|
| 024 | /usr/bin/killall coreaudiod |
|---|
| 025 | fi |
|---|
| 026 | |
|---|
| 027 | |
|---|
| 028 | exit 0 |
|---|
| AppleScriptで生成しました |
|---|