Ask Your Question
0

fedora 19 service management

asked 2013-10-28 12:12:51 -0500

drberta gravatar image

updated 2014-09-30 23:13:59 -0500

mether gravatar image

Hi all, I need to start a service before the login in my fedora 19. The service should launch an application in background as root before to enter as a user The bash script works properly, but calling it as a service it doesn't work The code of the service is the following:

[Unit]
Description=epcore server activation
After=multi-user.target
Before=getty.target

[Service]
Type=simple
ExecStart=/usr/local/bin/epcore.sh start
TimeoutSec=5

[Install]
WantedBy=multi-user.target
Alias=epcore.service

I have activated the service with the commands

systemctl daemon-reload
systemctl enable epcore.sh

Then I did a reboot. At the next power-up the service was not loaded.

Looking at /var/log/messages, I see the starting message of the service, but the application has not been loaded (perhaps it crashed)

Do you have any suggestion on how to manage the service

Thank you

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-11-14 17:28:02 -0500

drberta gravatar image

Thank you for the clarification. I solved the problem: to launch succesfully the application I had to define it as a fork. Why this?

edit flag offensive delete link more

Comments

Sorry for the late reply... I guess this is because you have an intermediate script (usr/local/bin/epcore.sh) which forks the real daemon process, "simple" means you start the process directly (which you may want to do unless your script does anything else besides starting the real process).

Nils Philippsen gravatar imageNils Philippsen ( 2013-12-11 08:37:32 -0500 )edit

Yes, you are right. Epcore.sh is a script used to launch a program, but before to do it I have to prepare the system creating a node for a usb device. Thus I can use the "simple" only if I want to start directly a program, otherwise I have to use "fork". Thank you for your clarification

drberta gravatar imagedrberta ( 2013-12-11 12:28:14 -0500 )edit
0

answered 2013-11-12 03:26:44 -0500

Nils Philippsen gravatar image

This shouldn't be necessary:

Alias=epcore.service

A systemd service unit needs a corresponding .service file, so simply name the file epcore.service, put it into /etc/systemd/system and run systemctl {enable,start,stop,...} epcore.service to manage it.

To reproduce your problem you needn't restart your machine, just use systemctl restart epcore.service and subsequently journalctl _SYSTEMD_UNIT=epcore.service to find the related log entries.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-10-28 12:12:51 -0500

Seen: 268 times

Last updated: Nov 14 '13