0

I have the following script, deploy.sh, on Ubuntu 18.04.3 LTS

#!/bin/sh
sudo -s
cd /home/engine.traderbot
git reset --hard
git pull origin master
cd /home/engine.traderbot/linuxscripts
chmod +x *
cd /home/engine.traderbot/config
rm configuration.tbc
cp ovhserver.tbc configuration.tbc

in file

-rwxrwxrwx 1 root root 371 Oct  2 15:59 deploy.sh

When I execute the script nothing is happening. I tried several things, read several Q&As and blogs but after a few hours I'm getting a little bit crazy. Things I tried include:

  • sudo ./deploy.sh
  • dos2unix deploy.sh
  • su root, followed by ./deploy.sh
  • sh deploy.sh

I should get the question for username/password from the git pull but nothing is happening. Also no error as well.

Any suggestions?

Stephen Kitt
  • 434,908
Justme
  • 103

1 Answers1

6

The sudo -s line will cause your script to open a shell, perhaps after asking for a password. It will only continue when you exit that new shell, and the overall impression could easily be that it finished without doing anything.

You should remove that line and run the script directly as whatever user it needs to be, so perhaps

sudo ./deploy.sh
Stephen Kitt
  • 434,908