1

I want to run after every reboot, with no user logged

kextunload /System/Library/Extensions/AppleHDA.kext

I tried to do a bash script here :

#!/bin/sh
PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin

kextunload /System/Library/Extensions/AppleHDA.kext
echo "Internal Speaker disabled"

however trying the bash script in terminal give me this result "command not found"

What do I do wrong if not everything.

PS : when resolved, do I just leave my script in "/etc/crontab" (so he can be run every time at boot) or do I still have to do env EDITOR=nano crontab -e and add the job

1 Answer 1

4

The script errors because you have split the command in two lines. Basically you want to remove the newlines between the PATH and the kextunload lines, so it looks like this:

#!/bin/sh
PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin kextunload /System/Library/Extensions/AppleHDA.kext
echo "Internal Speaker disabled"

But you could also just simplify all that down to a single line you can put in crontab:

/sbin/kextunload /System/Library/Extensions/AppleHDA.kext

When you add the cronjob with crontab -e then add it like this to get it run at every boot:

@reboot /sbin/kextunload /System/Library/Extensions/AppleHDA.kext
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .