× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Re: Need to add app as service, but still doing something wr

Retired_Member
Not applicable

Need to add app as service, but still doing something wrong

Hi (i am newbie)
i need to setup new service, in ReadyNAS 312, that would be launched after every startup (after restart).

I have achieved installing mongodb + mFi both correctly. mFi is the application.

Application is location in /apps/mFi/ folder.

I have this launch script inside /apps/mFi/mfi.sh

#!/bin/sh

case "$1" in
start)
cd /apps/mFi/
java -jar lib/ace.jar start &
;;
stop)
cd /apps/mFi/
java -jar lib/ace.jar stop
;;
esac

exit 0



script works ok, also the mFi application itself. It can be run or stopped by calling above script with command "sh mfi.sh start" or "sh mfi.sh stop".
As i have found, application is not launched after NAS unit restart. And i am unable to add it as a new service.
I was trying to use same guide as here (with teamspeak viewtopic.php?f=153&t=77743) but with no succes

i have tried creating file named mfi.service and placing it also into /lib/systemd/system/

[Unit]
Description=mFi
After=apache2.service

[Service]
WorkingDirectory=/apps/mFi
ExecStart=/apps/mFi/mfi.sh start
Type=forking
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

maybe code is wrong

and then adding service by "update-rc.d mfi defaults" or "update-rc.d mfi.service defaults" or "update-rc.d mFi defaults" with no success, it gave me this error or similar:

update-rc.d: using dependency based boot sequencing
update-rc.d: error: unable to read /etc/init.d/mfi.service


could you help?
Message 1 of 6
Retired_Member
Not applicable

Re: Need to add app as service, but still doing something wr

No you could not. I have helped myself 😄

Running these commands

systemctl daemon-reload
systemctl start mfi.service
systemctl enable mfi.service

has solved whole problem.
Message 2 of 6
mdgm-ntgr
NETGEAR Employee Retired

Re: Need to add app as service, but still doing something wr

Don't use update-rc.d. Everything should be started using systemctl. Glad you've solved your problem.
Message 3 of 6
Retired_Member
Not applicable

Re: Need to add app as service, but still doing something wr

Ok, thanks for the advice. Probably i have already did whole procedure with teamspeak service, but i forgot to make notes.

Maybe you could help me further with creating shortcut for mFi application, that would be displayed inside NAS admin - applications:

I have this "config.xml" file for teamspeak 3 placed in /apps/teamspeak3/ folder, that works well. So I have copied this file also into /apps/mFi/ folder.

I have tried changing servicename to "mfi.service" and debianpackage and resource id both to "MFi". Also launchurl port is changed to 6334 and reserveport too.
But application shortcut is displaying only in NAS admin frontend, but it is not displaying further in applications where i could turn service off / on.
Could you help me with this? I want to create controller that would be able to turn this service off / on directly from NAS admin - applications, as well as other standart apps.

/apps/mFi/config.xml

<Application resource-id="mFi"><!-- 'resource-id' must be AppName -->
<Category>APP_CAT_MEDIA</Category>
<Name>mFi</Name><!-- Any desciptive name, upto 48 chars -->
<Author>Ubiquiti</Author><!-- Authers name. upto 48 chars -->
<Version>5.0.0</Version><!-- Version -->
<MinFirmwareVer>6.1.3</MinFirmwareVer>
<RequireReboot>0</RequireReboot><!-- If non-zero, it indicate reboot is required. -->
<LaunchURL>http://localhost:6334/</LaunchURL><!-- 'localhost' will be replaced by framework JS. -->
<ConfigURL></ConfigURL>
<ReservePort>6334</ReservePort>
<DebianPackage>mFi</DebianPackage>
<ServiceName>mfi.service</ServiceName><!-- If start/stop need to start/stop service, specify service name -->
<Description lang="en-us">mFi</Description>
</Application>


Probably i have some error in debianpackage or resource id names, but where do i get them? (we are talking about mFi application)
Message 4 of 6
Retired_Member
Not applicable

Re: Need to add app as service, but still doing something wr

Thank you very much!
Message 5 of 6
mdgm-ntgr
NETGEAR Employee Retired

Re: Need to add app as service, but still doing something wr


# touch /apps/mFi/.localapp
Message 6 of 6
Top Contributors
Discussion stats
  • 5 replies
  • 4048 views
  • 0 kudos
  • 2 in conversation
Announcements