Answer the question
In order to leave comments, you need to log in
How it is possible to implement service restart via webhook?
Good afternoon! We set the task of making a webhook in gitlab on a push event, OS centos 7, gitlab EE . The implementation was made according to this article . The webhook itself is working, the changes are being pushed. But here they also set the task of restarting the service after the changes are launched. This is where it starts. I'm trying to restart through the apache user, but an error occurs in the log sudo: sorry, you must have a tty to run sudo
if sudo is disabled Defaults requiretty
, then this kind of error
Failed to restart asterisk.service: Interactive authentication required.
#!/bin/sh
#не знаю что за строка
cd .. > /dev/null &
cd /etc/asterisk
/usr/bin/git pull
sudo /etc/rc.d/init.d/asterisk restart
apache ALL=(ALL) NOPASSWD: /etc/rc.d/init.d/asterisk restart
Answer the question
In order to leave comments, you need to log in
add a string like
echo $USER
whoami
or something to the script to be sure which user the script is running as. then bring the settings to court.
// ehh, I rubbed my eyes. there about the lack of tty...
hello diary^W^W here it is! https://www.shell-tips.com/2014/09/08/sudo-sorry-y...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question