Get OS X Notification Center State From the Command Line
Solution 1:
You actually can find out if the Do Not Disturb is currently enabled or disabled. Notification Center drops a plist in the following location that you can read the value of. Run the following to find the plist file:
ls ~/Library/Preferences/ByHost/com.apple.notificationcenterui.*.plist
Now, you can read the value from the plist you just found by using:
defaults read ~/Library/Preferences/ByHost/com.apple.notificationcenterui.8D3EA20D-8D7F-52E2-9F99-BC17A13A3F0E.plist
NOTE: your actual filename may be different than what I have listed above.
You will see a key called "doNotDisturb" and it will either have a value of 1 or 0 (enabled or disabled)
You can also change it's status by doing:
defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.8D3EA20D-8D7F-52E2-9F99-BC17A13A3F0E.plist doNotDisturb 1
or:
defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.8D3EA20D-8D7F-52E2-9F99-BC17A13A3F0E.plist doNotDisturb 0
To make the change take effect, you'll need to restart Notification Center by typing:
killall NotificationCenter
I've actually written a very simple Automator script so now I can enable/disable the Do Not Disturb for Notification Center with a keyboard shortcut. Very handy. :)
Solution 2:
To get the Do not disturb status in Yosemite, just enter the following in your terminal:
defaults read ~/Library/Preferences/ByHost/com.apple.notificationcenterui.plist doNotDisturb
Solution 3:
Probably the best way I can think of is to install terminal notifier and send it a message from the terminal.
Install Terminal Notifier
Terminal notifier can be installed through Ruby Gems
Type:
sudo gem install terminal-notifier
Send NC a message
Type:
terminal-notifier -message "The notification center is running" -title "NC Status"
If notification center is running you'll get a message that says "The notification center is running"