提交 38e7275b 编写于 作者: P plum-lihui

[Modify the use of sudo commands]

上级 4db1f9fa
#!/bin/bash #!/bin/bash
csudo=""
if command -v sudo > /dev/null; then
csudo="sudo"
fi
function is_using_systemd() { function is_using_systemd() {
if pidof systemd &> /dev/null; then if pidof systemd &> /dev/null; then
return 0 return 0
...@@ -11,9 +16,9 @@ function is_using_systemd() { ...@@ -11,9 +16,9 @@ function is_using_systemd() {
# Stop the service if running # Stop the service if running
if pidof taosd &> /dev/null; then if pidof taosd &> /dev/null; then
if is_using_systemd; then if is_using_systemd; then
sudo systemctl stop taosd || : ${csudo} systemctl stop taosd || :
else else
sudo service taosd stop || : ${csudo} service taosd stop || :
fi fi
echo "Stop taosd service success!" echo "Stop taosd service success!"
sleep 1 sleep 1
...@@ -23,6 +28,6 @@ fi ...@@ -23,6 +28,6 @@ fi
cfg_install_dir="/etc/taos" cfg_install_dir="/etc/taos"
install_main_dir="/usr/local/taos" install_main_dir="/usr/local/taos"
if [ -f ${cfg_install_dir}/taos.cfg ]; then if [ -f ${cfg_install_dir}/taos.cfg ]; then
sudo rm -f ${install_main_dir}/cfg/taos.cfg || : ${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
fi fi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册