Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/local/bin/servicectl: 16: [: -ne: unexpected operator #4

Open
OverWorldD opened this issue Sep 23, 2018 · 11 comments
Open

/usr/local/bin/servicectl: 16: [: -ne: unexpected operator #4

OverWorldD opened this issue Sep 23, 2018 · 11 comments

Comments

@OverWorldD
Copy link

trying this to start crate from within linux deploy on android debian jessie gets me:
android@localhost:$ sudo servicectl enable crate
/usr/local/bin/servicectl: 16: [: -ne: unexpected operator
/usr/local/bin/servicectl: 23: /usr/local/bin/servicectl: Syntax error: "(" unexpected
android@localhost:
$

@onlyjob
Copy link

onlyjob commented Sep 24, 2018

This project is either dormant or abandoned.
Try https://github.com/gdraheim/docker-systemctl-replacement instead.

@passcod
Copy link

passcod commented Nov 11, 2018

These scripts assume /bin/sh is bash. Just replace the shebang with your path to bash and it will work.

@softwarecreations
Copy link

I also had this issue, but it gets worse. After fixing the shebangs the scripts don't work on Debian Stretch in Linux Deploy on Android.
They only expect service files to be in /usr/lib/systemd/system/ when they are actually in /etc/systemd/system/

@softwarecreations
Copy link

This project is either dormant or abandoned.
Try https://github.com/gdraheim/docker-systemctl-replacement instead.

I agree that this project seems to be dormant/abandoned, but I'm not wanting docker stuff.

@austinweisgrau
Copy link

austinweisgrau commented Nov 30, 2020

I got this particular line to work by changing two lines in /usr/local/bin/servicectl but there are still other issues that I haven't been able to figure out.

In case anyone's curious:

line 0: #!/bin/sh to #!/bin/bash
&
line 16: if [ $EUID -ne 0 ]; then to if [ "$EUID" -ne 0 ]; then

based on: https://stackoverflow.com/questions/18215973/how-to-check-if-running-as-root-in-a-bash-script

I'm running ubuntu 18.04 bionic in a chroot

@Mahoo12138
Copy link

I got this particular line to work by changing two lines in /usr/local/bin/servicectl but there are still other issues that I haven't been able to figure out.

In case anyone's curious:

line 0: #!/bin/sh to #!/bin/bash & line 16: if [ $EUID -ne 0 ]; then to if [ "$EUID" -ne 0 ]; then

based on: https://stackoverflow.com/questions/18215973/how-to-check-if-running-as-root-in-a-bash-script

I'm running ubuntu 18.04 bionic in a chroot

root@localhost:~# servicectl restart sshd
Error: attribute PIDFile not exists in file /usr/lib/systemd/system/sshd.service
Error: file /usr/lib/systemd/system/sshd.service cannot be opened

↑ ?

@Xie-Long-0
Copy link

Error: attribute PIDFile not exists in file /usr/lib/systemd/system/sshd.service
Error: file /usr/lib/systemd/system/sshd.service cannot be opened

It works for me by changing line 7:
SYSTEMD_UNITS_PATH="/usr/lib/systemd/system/" to SYSTEMD_UNITS_PATH="/lib/systemd/system/"

@ruquanzhao
Copy link

ruquanzhao commented Jun 12, 2022

It works for me by changing line 7: SYSTEMD_UNITS_PATH="/usr/lib/systemd/system/" to SYSTEMD_UNITS_PATH="/lib/systemd/system/"

Hi, what's environment you are using? @Xie-Long-0

I run this in docker container. I noticed it called kill -TERM $PID in action stop and restart, I run this manually, but this doesn't work, may because of the PID namespace isolation.

@Xie-Long-0
Copy link

Xie-Long-0 commented Jun 16, 2022

what's environment you are using?

@ruquanzhao
I run in chroot, which created by Linux Deploy on Android.
Seems like its pids are inherited from the host.

@fatinghenji
Copy link

fatinghenji commented Aug 30, 2022

@Xie-Long-0 I run in chroot, which created by Linux Deploy on Android. Seems like its pids are inherited from the host.
I'm also using linux deploy and changed the code as you said(#4 (comment)), but the problem still exists

root@localhost:/etc# servicectl restart mcsm-web.service
Error: attribute PIDFile not exists in file /lib/systemd/system/mcsm-web.service
Error: file /lib/systemd/system/mcsm-web.service cannot be opened

@yuanjv
Copy link

yuanjv commented Oct 16, 2022

this problem was fixed but...
WARN[IMNOTGONNASHOWYOUTHETIME] Error while setting daemon root propagation, this is not generally critical but may cause some functionality to not work or fallback to less desirable behavior dir=/var/lib/docker error="error writing file to signal mount cleanup on shutdown: open /var/run/docker/unmount-on-shutdown: no such file or directory"
Failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants