nickv-nextcloud / talk_simple_poll

A simple chat based poll for Nextcloud Talk
GNU Affero General Public License v3.0
12 stars 3 forks source link

Trouble running the commands after app install... #7

Closed WNYmathGuy closed 5 years ago

WNYmathGuy commented 5 years ago

I think all my system info you need is at this link: https://cloud.ruppssites.com/index.php/s/fMEsxwkEnWtgE6P/authenticate/showShare and the super secret password is cGgddmc0dU6lEiiNM1/D

I got to this section:

  1. Install the app
  2. Setup the commands (you need to use your full path to occ, also don't use sudo -u www-data inside the command, because it is automatically run as www-data):
    sudo -u www-data /var/www/nextcloud/occ talk:command:add poll Poll '/var/www/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
    sudo -u www-data /var/www/nextcloud/occ talk:command:add vote Poll '/var/www/nextcloud/occ talk:poll:vote {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3

    and usually when I'm told by a Nextcloud developer to do sudo -u www-data /occ ... it never works, but if I do php /occ ... it does. The sudo has an issue when logged in as the Nexcloud virtual server owner.

To put another fly in the ointment, I manage my physical server with Virtualmin, and the first set of attempts were logged in as the user for the virtual host that owns Nextcloud, the second set of attempts were as the administrator of the physical server. Below are the terminal outputs:

ncadmin@srv1:~$ cd domains/cloud.ruppssites.com/public_html/nextcloud/

ncadmin@srv1:~/domains/cloud.ruppssites.com/public_html/nextcloud$ php /occ talk:command:add poll Poll '/home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
Could not open input file: /occ

ncadmin@srv1:~/domains/cloud.ruppssites.com/public_html/nextcloud$ /occ/talk:command:add poll Poll '/home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
-bash: /occ/talk:command:add: No such file or directory

ncadmin@srv1:~/domains/cloud.ruppssites.com/public_html/nextcloud$ /occ talk:command:add poll Poll '/home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
-bash: /occ: No such file or directory

ncadmin@srv1:~/domains/cloud.ruppssites.com/public_html/nextcloud$ php occ talk:command:add poll Poll '/home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
sh: 1: /home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ: Permission denied
The script is invalid
srvadmin@srv1:~$ sudo -u www-data /home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:command:add poll Poll '/home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
[sudo] password for srvadmin: 
sudo: /home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ: command not found

srvadmin@srv1:~$ php /home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:command:add poll Poll '/home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
Could not open input file: /home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ
nickvergessen commented 5 years ago

If you need ro prepend php to run occ, you also need to prepend it on the command

php occ talk:command:add poll Poll 'php /home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
php occ talk:command:add vote Poll 'php /home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll:vote {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
WNYmathGuy commented 5 years ago

Thanks @nickvergessen ! It seems so obvious now. :man_facepalming:

ncadmin@srv1:~/domains/cloud.ruppssites.com/public_html/nextcloud$ php occ talk:command:add poll Poll 'php /home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}"' 2 3
Command added

+----+-----+------+---------+------------------------------------------------------------------------------------------------------------------------------------+----------+---------+
| id | app | name | command | script                                                                                                                             | response | enabled |
+----+-----+------+---------+------------------------------------------------------------------------------------------------------------------------------------+----------+---------+
| 2  |     | Poll | poll    | php /home/ncadmin/domains/cloud.ruppssites.com/public_html/nextcloud/occ talk:poll {ROOM} {USER} "{ARGUMENTS_DOUBLEQUOTE_ESCAPED}" | 2        | 3       |
+----+-----+------+---------+------------------------------------------------------------------------------------------------------------------------------------+----------+---------+

If you think your command makes sense for other users as well, feel free to share it in the following github issue:
 https://github.com/nextcloud/spreed/issues/1566