NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Retired_Member
May 17, 2015Need 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
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/
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:
could you help?
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?
6 Replies
- crane10970Aspirant
This really works.
Or just simply:
touch /apps/mFi/config.xml
Thank you!
- mdgm-ntgrNETGEAR Employee Retired
# touch /apps/mFi/.localapp - Retired_MemberThank you very much!
- Retired_MemberOk, 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) - mdgm-ntgrNETGEAR Employee RetiredDon't use update-rc.d. Everything should be started using systemctl. Glad you've solved your problem.
- Retired_MemberNo you could not. I have helped myself :-D
Running these commands
systemctl daemon-reload
systemctl start mfi.service
systemctl enable mfi.service
has solved whole problem.
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!