servicectl icon indicating copy to clipboard operation
servicectl copied to clipboard

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

Open OverWorldD opened this issue 6 years ago • 11 comments

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:~$

OverWorldD avatar Sep 23 '18 15:09 OverWorldD

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

onlyjob avatar Sep 24 '18 06:09 onlyjob

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

passcod avatar Nov 11 '18 06:11 passcod

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 avatar Jun 23 '19 12:06 softwarecreations

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.

softwarecreations avatar Jun 23 '19 12:06 softwarecreations

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

austinweisgrau avatar Nov 30 '20 19:11 austinweisgrau

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

↑ ?

Mahoo12138 avatar Nov 12 '21 17:11 Mahoo12138

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/"

Xie-Long-0 avatar May 25 '22 12:05 Xie-Long-0

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.

ruquanzhao avatar Jun 12 '22 15:06 ruquanzhao

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.

Xie-Long-0 avatar Jun 16 '22 07:06 Xie-Long-0

@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(https://github.com/smaknsk/servicectl/issues/4#issuecomment-1137206830), 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

fatinghenji avatar Aug 30 '22 09:08 fatinghenji

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

yuanjv avatar Oct 16 '22 07:10 yuanjv