Setting DND via SSH

I’m trying to set the DND on an extension via SSH. I want to do this in order to get my home automation system (Home Assistant) to set the DND on my home office phone based on if my computer is locked. I started apost about this a year ago but couldn’t get it to work. I now have the time to revisit this. In that thread I was pointed towards this solution.

I put the file lgaetz-dnd.php in my /etc directory and am using this command with no luck:

[[email protected] etc]# lgaetz-dnd.php unset 320
-bash: lgaetz-dnd.php: command not found
[[email protected] etc]# 

Where am I going wrong? I’d imagine it’s something simple that I’m not doing correctly.

If a script is not in the user’s PATH, The script needs to be called with a full reference, /etc is not in any normal path, so move it to somewhere appropriate or call it as

/etc/lgaetz-dnd.php unset  320

(echo $PATH|tr ‘:’ ‘\n’)

Beware of the forum butcher:
echo $PATH|tr ':' '\n'

1 Like

Also im pretty sure you cant just randomy call php scripts from a commandline, without providing an interpreter. Maybe try

/usr/bin/php /etc/lgaetz-dnd.php unset 320

The script has a hashbang

1 Like

Script must be exectutable:

chmod +x /etc/lgaetz-dnd.php

Boom! That did it. Thanks!

Honorable mention to the creator @lgaetz as well. I had not made it executable.

Thanks guys!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.