Ask Your Question
0

How do I test a traditional init.d script under fedora 19.

asked 2014-01-19 04:26:57 -0600

Krist gravatar image

Hello,

Fedora has done away with traditional init.d scripts. But some packages still install them, and I have one that I need to be able to start manually (to debug it) but I can't

systemctl hijacks execution of scripts in /etc/init.d

So I type "/etc/init.d/myservice stop" and in stead of the script running with the stop command, systemctl intervenes, and pretends to stop the service, but actually appears to do nothing. The code in the script never gets executed.

How do I avoid that? How do I execute traditional init.d scripts on the command line under fedora?

edit retag flag offensive close merge delete

Comments

As a test, I tried /etc/init.d/vboxdrv start and then /etc/init.d/vboxdrv stop and both commands seemed to work as expected, this is with F20. It could be something with your script.

You can examine /etc/init.d/myservice and see what the start() function does and do it by hand. Also using sh -x /etc/init.d/myservice stop should display more output about what's goes on.

Ahmad Samir gravatar imageAhmad Samir ( 2014-01-20 12:05:20 -0600 )edit

I can indeed to all the above. However, I want to see the script work. I want to make certain that when the system is stopped the service is properly stopped as well. For this I want to be able to do "/etc/init.d/myservice stop". What I am really looking for is to pointers that explain me how these scripts are started by whatever is respoinsible for starting them under F19.

Krist gravatar imageKrist ( 2014-01-21 04:53:02 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-01-19 14:26:11 -0600

mether gravatar image

Hi

You should look at the script directly. It probably sources . /etc/init.d/functions which invokes the redirection. You can comment it out potentially and run it. Alternatively systemctl itself show debug output

systemctl status rngd.service

rngd.service - Hardware RNG Entropy Gatherer Daemon
Loaded: loaded (/usr/lib/systemd/system/rngd.service; enabled)
Active: failed (Result: exit-code) since Fri 2014-01-17 14:08:02 EST; 2 days ago
Main PID: 950 (code=exited, status=1/FAILURE)
CGroup: /system.slice/rngd.service

Jan 17 14:08:02 mether systemd[1]: Started Hardware RNG Entropy Gatherer Daemon.
Jan 17 14:08:02 mether rngd[950]: Unable to open file: /dev/tpm0
Jan 17 14:08:02 mether rngd[950]: can't open any entropy source
Jan 17 14:08:02 mether rngd[950]: Maybe RNG device modules are not loaded
Jan 17 14:08:02 mether systemd[1]: rngd.service: main process exited, code=...RE
Jan 17 14:08:02 mether systemd[1]: Unit rngd.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
edit flag offensive delete link more

Comments

I can indedd comment /etc/init.d/functions, but that might break other things. I can see that the script is somehow executed upon boot. But when I do it myself nothing is done. How do I mimic the way the script is started upon boot?

Krist gravatar imageKrist ( 2014-01-20 03:43:56 -0600 )edit

Question Tools

Stats

Asked: 2014-01-19 04:26:57 -0600

Seen: 1,740 times

Last updated: Jan 19 '14