Autostart service (systemd)
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2017
    Location
    Other Planet
    Posts
    26

    Autostart service (systemd)

    I'm quite new with Fedora and linux in general, and don't know many things, one of them - How to autostart systemd service?
    Long story short, I'm using software that requires license server to run. There is license server which was using system V (i'm not sure ) script to start license server.
    This was done by going sudo, /etc/init.d and then execute ./sesinetd start, and it really annoying after every reboot execute this command,
    I made a service with this helpful tutorial: https://gist.github.com/houtianze/59...1d3c4bd86e6ee7
    so now after reboot, I can write - sudo service sesinetd start
    all works, but how to start this automatically?

  2. #2
    Join Date
    Jan 2010
    Posts
    7,349

    Re: Autostart service (systemd)


  3. #3
    Join Date
    Dec 2007
    Location
    Australia
    Posts
    1,859

    Re: Autostart service (systemd)

    This was done by going sudo, /etc/init.d and then execute ./sesinetd start, and it really annoying after every reboot execute this command,
    I made a service with this helpful tutorial: https://gist.github.com/houtianze/59...1d3c4bd86e6ee7
    so now after reboot, I can write - sudo service sesinetd start
    all works, but how to start this automatically?
    Since you have a sysvinit script, I think all you have to do to have it start on boot is to tell chkconfig which runlevels it's to run on, e.g.:
    Code:
    chkconfig -level 345 sesinetd on
    should start the script at boot on runlevels 3, 4 and 5.

    systemd runs the scripts linked at /etc/systemd/system, but I think you need a systemd config in /usr/lib/systemd/system for that.

  4. #4
    Join Date
    Sep 2017
    Location
    Other Planet
    Posts
    26

    Re: Autostart service (systemd)

    hm. maybe I'm doing something wrong but still the same thing. no autostart. but after enabling services I get something:
    sudo systemctl enable sesinetd
    Synchronizing state of sesinetd.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
    so probably made something wrong. I'm not sure.

  5. #5
    Join Date
    Dec 2007
    Location
    Australia
    Posts
    1,859

    Re: Autostart service (systemd)

    Perhaps have a look at this explanation:
    https://www.turnkeylinux.org/blog/de...sv-init-compat

    Dunno if it'll help.

    Just thinking, what would happen if you enable the system-sysv-install service with: systemctl enable ....? I suppose it would be sesinitd to enable if systemd has configured it into itself. I'd try it anyway.
    Last edited by nsnbm; 9th January 2018 at 11:29 PM.

  6. #6
    Join Date
    Jun 2005
    Location
    Montreal, Que, Canada
    Posts
    5,397

    Re: Autostart service (systemd)

    Since it is a server, why not put the restart command into a crontab with a line that starts. @reboot. You could even do the automatic restart a few minutes after the true reboot. The advantage is that it is a one liner for crontab. Use root for the crontab. Do not forget to put the appropriate PATH statement or launch a shell command that does it for you.
    .
    Leslie in Montreal

    Interesting web sites list
    http://forums.fedoraforum.org/showth...40#post1697840

  7. #7
    Join Date
    Sep 2017
    Location
    Other Planet
    Posts
    26

    Re: Autostart service (systemd)

    I was able to convert script to service. but don't know how to make it run in sudo mode,
    as I understood from log, it can't start automatically because of that.

    Feb 15 13:46:00 workstation-pc systemd[1]: Started LSB: Script to start and stop the Houdini License Manager.
    Feb 15 13:46:00 workstation-pc sesinetd[1608]: FAILED
    Feb 15 13:45:40 workstation-pc sesinetd[1608]: Starting Houdini License server/etc/rc.d/init.d/sesinetd: /usr/lib/sesi/sesinetd_safe: /bin/sh: bad interpreter: Permission denied
    Feb 15 13:45:40 workstation-pc systemd[1]: Starting LSB: Script to start and stop the Houdini License Manager...
    Feb 15 13:45:36 workstation-pc systemd[1]: /etc/systemd/system/sesinetd.service:17: Failed to parse service restart specifier, ignoring: yes
    Any tips?

  8. #8
    Join Date
    Oct 2011
    Posts
    1,863

    Re: Autostart service (systemd)

    System services always runs as root if not configured otherwise. It might be possible that SELinux is blocking the script.

    Please open a new thread and give more details.

  9. #9
    Join Date
    Sep 2017
    Location
    Other Planet
    Posts
    26

    Re: Autostart service (systemd)

    I made this:
    In /etc/selinux/config
    set the line
    SELINUX = enforcing
    to
    SELINUX = permissive
    and it solved my problem. now it starts automatically after reboot.

  10. #10
    Join Date
    Apr 2009
    Location
    central NY, USA
    Posts
    1,133

    Re: Autostart service (systemd)

    Well, but the problem is still there - it's just that Selinux is no longer blocking access. If you know which file Selinux is complaining about, you could do a 'restorecon' on it as root. Alternatively, you could have Selinux do a system relabel but that takes a very long time at the next boot. In either case, I'd fix the problem and set Selinux back to enforcing. If you opt for the relabel and reboot, there will be a point where it looks like your system got stuck/hung - it ISN'T. One of my systems takes almost a half hour to relabel.
    Change - the only constant.

Similar Threads

  1. [SOLVED]
    Creating a custom systemd service
    By matth45 in forum Using Fedora
    Replies: 3
    Last Post: 22nd July 2016, 08:20 PM
  2. Systemd 'service' script not running
    By roshichris in forum Using Fedora
    Replies: 7
    Last Post: 7th August 2015, 07:17 PM
  3. ip_forward systemd service
    By bienchen in forum Servers & Networking
    Replies: 3
    Last Post: 13th March 2014, 10:12 AM
  4. systemd user service manager support (systemd --user)
    By survient in forum Using Fedora
    Replies: 2
    Last Post: 5th December 2013, 04:52 PM
  5. How to disable a systemd service?
    By Japplo in forum F16 Development
    Replies: 8
    Last Post: 5th September 2011, 01:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •