ss-bash
ss-bash copied to clipboard
cannot run "sudo /etc/ss-bash/ssadmin.sh start" in /etc/rc.local
I can run it in ssh, but when I put "sudo /etc/ss-bash/ssadmin.sh start" in /etc/rc.local, I always receive an error message saying "sscounter.sh启动失败"
The below is the error log, any idea?
rc-local.service - /etc/rc.local Compatibility Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled) Drop-In: /lib/systemd/system/rc-local.service.d └─debian.conf Active: failed (Result: exit-code) since Thu 2017-07-13 03:18:37 UTC; 11min ago Process: 1150 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)
Jul 13 03:18:33 ubuntu-16-04-LTS-SG systemd[1]: Starting /etc/rc.local Compatibility... Jul 13 03:18:35 ubuntu-16-04-LTS-SG sudo[1152]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/etc/ss-bash/ssadmin.sh start Jul 13 03:18:35 ubuntu-16-04-LTS-SG sudo[1152]: pam_unix(sudo:session): session opened for user root by (uid=0) Jul 13 03:18:37 ubuntu-16-04-LTS-SG rc.local[1150]: sscounter.sh启动中... Jul 13 03:18:37 ubuntu-16-04-LTS-SG rc.local[1150]: sscounter.sh启动失败 Jul 13 03:18:37 ubuntu-16-04-LTS-SG systemd[1]: rc-local.service: Control process exited, code=exited status=1 Jul 13 03:18:37 ubuntu-16-04-LTS-SG systemd[1]: Failed to start /etc/rc.local Compatibility. Jul 13 03:18:37 ubuntu-16-04-LTS-SG systemd[1]: rc-local.service: Unit entered failed state. Jul 13 03:18:37 ubuntu-16-04-LTS-SG systemd[1]: rc-local.service: Failed with result 'exit-code'.
Failed to run sscounter. Maybe failed to create interval timer.
Because sscounter runs as a process,not a daemon, it may have some problem in such a special session (rc.local)
Here is my /etc/rc.local
#!/bin/sh -e /root/customer/ss-bash-master/ssadmin.sh start > /root/ssadmin_log.log /appex/bin/lotServer.sh start -> /root/lotServer_log.log exit 0
there are two auto start command, It can start lotServer.sh correctly, but cannot start ssadmin.sh However, ssadmin_log.log shows ssadmin has been started
sscounter.sh启动中... 677 ? S 0:00 /bin/bash /root/customer/ss-bash-master/sscounter.sh sscounter.sh已启动 ssserver启动中... 704 ? S 0:00 /usr/bin/python3 /usr/local/bin/ssserver -qq -c /root/customer/ss-bash-master/ssmlt.json ssserver已启动
But when I run /root/customer/ss-bash-master/ssadmin.sh status
show ssadmin.sh has NOT ben started.
~# /root/customer/ss-bash-master/ssadmin.sh status ssserver未启动 sscounter.sh未启动
Why ?
I have fingure out the problem.
change #!/bin/sh -e
to #!/bin/bash
can solve the problem