Hi,
I created a c file which I crosscompiled and ran in the device absolutely fine but when I create a service out o that, Its running twice .. Can anyone tell me what might be the reason.
Following is the init script I am using
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
APP=/usr/bin/my-app
start_service() {
procd_open_instance
procd_set_param command "$APP"
procd_close_instance
}
ls -l /etc/rc.d | grep -e svc_name
yeah its creating 2 instances
lrwxrwxrwx 1 root root 17 Jun 15 19:17 K01my-app -> ../init.d/my-app
lrwxrwxrwx 1 root root 17 Jun 15 19:17 S95my-app -> ../init.d/my-app
lrwxrwxrwx 1 root root 17 Jun 15 19:17 S99my-app -> ../init.d/my-app
but what would be the cause ? I just created a 99 so I understand the S99 but why the S95? can you please tell me .. and I didnt add a stop so why did it add a K01 ?
And I also created a bash script which I can see has also replicated to S99 which I only put as 95 but in the processes I just see one instance of the script.. I am confused.. Please help
/etc/init.d/my-app disable
/etc/init.d/my-app enable
ls /etc/rc.d/*my-app
wow its giving me a permission denied
/etc/init.d/my-app disable
/etc/rc.common: /etc/init.d/my-app: line 13: /root: Permission denied
/etc/rc.common: /etc/init.d/my-app: line 14: /root: Permission denied
chmod +x /etc/init.d/my-app
Its set to chmod 777 but still gives a permission denied I dont understand this
/etc/init.d/my-app disable
/etc/rc.common: /etc/init.d/my-app: line 13: /root: Permission denied
/etc/rc.common: /etc/init.d/my-app: line 14: /root: Permission denied
-rwxrwxrwx 1 root root 179 Jun 15 18:56 /etc/init.d/my-app
sed -n -e 13,14p /etc/init.d/my-app
I removed some spaces from the file so now it was showing this
etc/init.d/my-app disable
/etc/rc.common: /etc/init.d/my-app: line 11: /root: Permission denied
so I did
sed -n -e 11p /etc/init.d/my-app
Output:
~
okay so removing that last ~ let it disable it .. Can you please tell me why..
Okay now just one instance is running , but how can I do that when building it .... Is there a way to not stop it and just create one service ?
Okay I restarted the device and its back to the same state. and now when I disabled and enabled it back there is no change.. the 2 processes still exist.
And its also giving a bunch of which are not required
5391 root 0 Z [my-app]
5780 root 0 Z [my-app]
6184 root 0 Z [my-app]
6578 root 0 Z [my-app]
8989 root 0 Z [my-app]
9390 root 0 Z [my-app]
9783 root 0 Z [my-app]
10178 root 0 Z [my-app]