LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Is there an easy way to convert sysV to systemd scripts? Or add dependencies to a sysV script? (https://www.linuxquestions.org/questions/linux-software-2/is-there-an-easy-way-to-convert-sysv-to-systemd-scripts-or-add-dependencies-to-a-sysv-script-4175591726/)

irey 10-19-2016 06:31 AM

Is there an easy way to convert sysV to systemd scripts? Or add dependencies to a sysV script?
 
I just installed Snort on a Fedora 24 system. The official RPMs from snort.org are made for Fedora 21 (don't know how relevant that is but mentioning it just in case). It includes a sysV init script: /etc/init.d/snortd.

Just set up the configuration and used systemctl to enable the service at boot, everything fine except that... snort starts too early. The network has not been initialized yet, so it complains that the interface is down and exits.

Code:

Oct 19 12:35:06 localhost snort[405]: FATAL ERROR: Can't start DAQ (-1) - enp2s0: That device is not up!
It only works if I start it by hand after login (sudo systemctl start snortd).

So I tried creating a directory '/etc/systemd/system/snortd.wants' and putting there a symlink to NetworkManager.service. I was hoping this would make snort start after NetworkManager does, but it didn't solve the problem. I guess sysV init scripts cannot have dependencies the way a systemd service would.

Any suggestions? Thanks.

BW-userx 10-19-2016 06:39 AM

Fedora 16 Chapter 7. Services and Daemons

if [ check to see if needed services is running yet ] ; then run that code .. place within the file that is needing to be started after the other service is started. loop it. ????

or if the system is calling for this one to be started first, maybe do this
Code:

if [ ! network ] ; then
start network
start this service
fi

OH here I found this too, I haven't read it but it might be useful

SysVinit to Systemd Cheatsheet Fedora


search pattern used: sysV starting services in order

syg00 10-19-2016 06:51 AM

You need to create a service file for it that defines the startup dependency. Simple search found two almost identical examples - Fedora and Ubuntu.


All times are GMT -5. The time now is 03:32 PM.