SSH -y root@192.168.222.102 '/etc/init.d/mykika start' doesn work remotly

when i try remotly

ssh -y root@192.168.222.102  '/etc/init.d/mykika restart'

it restarting my init.d start script but the script itself starting and stuckin not working not running
but if i do locally

etc/init.d/mykika restart

everything is fine
Why it can be that remotly it trigers the script but the script wont work (but it starts and stopes)

i even copied .ssh root ro .ssh
also is i send reboot command all works fine too

What happens if you leave out the -y argument?

1 Like

it is the same

#!/bin/sh /etc/rc.common
# Example script
# Copyright (C) 2007 OpenWrt.org

START=99
STOP=1

start() {        
       /bin/ash /bin/mykika/mykikaconsole.sh &
}                 
 
stop () {
	kill -9 $(ps | grep 'mykika' | grep ash | awk '{print $1;}')
}

shutdown() {
	kill -9 $(ps | grep 'mykika' | grep ash | awk '{print $1;}')
}

this is just my kika executer in rc.d simlinked to init.d

but when i do localy all good

also somthing keeps creating my simlinks , making some kind of copies in rc.d
i deleting them but they keeps comming again after reboot :ghost:

I wonder if you should run it via a local script...

so, create a script on the router (maybe /root/restart_mykika) that does just this:

/etc/init.d/mykika restart

and make sure it is executable... test that it works when run from the router itself.

chmod 777 /root/restart_mykika
/root/restart_mykika

If that works, then try using your ssh connection to do this:

ssh root@192.168.222.102  '/root/restart_mykika'
1 Like

yeah i was thinking about that but now i noticing somthing strange in rc.d so i will be back in 10 minutes
maybe a demon wont let it do

it is the same i just made the script and run it and the it restarted my script mykikaconsole.sh but
it stuck again but localy all good and there is no process in top.
runnig the restart_mykika locally all works fine

I'm not sure why this would be problematic....
What about other services (for example, maybe uhttpd or dnsmasq or whatever)? Can you remotely restart those services? If so, maybe it is something specific with the mykika service.

2 Likes

idk if i can call it a service but it is just a ash script
i tried to stop start restart remotely (dnsmasq) all works fine
but why that is the question
the other odd thing is i connect to the host via ssh and execute /etc/init.d/mykika restart all works !

The reason was my script starts with

sleep $1 (20)
so my thoughts are that remotely script started but by the time it is actually doing somthing the remote root alredy disconected so the procces of script is stoping

if i make like this all good all works remotly

#!/bin/sh /etc/rc.common

START=99
STOP=1

start() {
/bin/ash /bin/mykika/mykikaconsole.sh 20 &
sleep 21
}

stop () {
kill -9 $(ps | grep 'mykika' | grep ash | awk '{print $1;}')

}

shutdown() {
kill -9 $(ps | grep 'mykika' | grep ash | awk '{print $1;}')

}

But the thing is i need this delay , my script manages hostapd so i need to start script as later as posible

and i decided to give up on that and made 10 second deley before start so i had to put sleep 12 for 2 second for exucute full script and then remote ssh disconects (after script fully started!)

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.