0

I got my init.sh file for installing seafile. When calling:

if  [ ! -f /config/init_completed ]; then
    ...
else
  # start seafile
  sudo bash ${INSTALLPATH}seafile.sh start
  sudo bash ${INSTALLPATH}seahub.sh start
  # keep seafile running in foreground to prevent docker container shutting down
  while true; do
    sudo tail -f /opt/seafile/logs/seafile.log
    sleep 10
  done

fi

I got the error: /scripts/init.sh: line 44: sudo: command not found

Install Path is a environmental Variable set in the Dockerfile:

ENV SEAFILE_VERSION seafile-server-6.3.4
ENV INSTALLPATH /opt/seafile/${SEAFILE_VERSION}/

whoami output is root

Without the sudo command the error is (guess it's cause I don't have permissions without sudo):

bash: /opt/seafile/seafile-server-6.3.4/seafile.sh: No such file or 
directory
  • @JeffSchaller If I put an sudo ls -l ${INSTALLPATH}seafile.sh before (in the else condition) it reports with the same error. If I run it without sudo the second error occurs. – Ora nge Apr 10 at 13:38
  • Maybe it has something to do with the if condition? – Ora nge Apr 10 at 13:39
  • @JeffSchaller I'm not logged in as root, but when adding an "whoami" it tells me "root" – Ora nge Apr 10 at 13:41
  • @JeffSchaller I also did that. It's telling: ls: cannot access '/opt/seafile/seafile-server-6.3.4/seafile.sh': No such file or directory – Ora nge Apr 10 at 13:43
  • 1
    That's a great edit to your post, then; it narrows the problem down. I suspect one of your variables has a non-printing whitespace character in it (carriage return, likely) – Jeff Schaller Apr 10 at 13:46
0

Sudo is not installed in Debian by default. You can install it with the command
apt-get install sudo
Or you can edit the script, remove the sudo references and run it as root.

The second error

bash: /opt/seafile/seafile-server-6.3.4/seafile.sh: No such file or directory

Is bash saying that there is no file with the name seafile.sh in the /opt/seafile/seafile-server-6.3.4/ directory. Check both names (maybe you have to extract some file before, or maybe the seafile version is different from 6.3.4) and try again.

  • I already installed "sudo" by doing so. It works fine in every other command. The file exists and also is spelled correctly. – Ora nge Apr 10 at 12:55
0

I solved the problem by adding sudo to ENTRYPOINT sudo bash /scripts/init.sh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.