LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-07-2019, 02:09 AM   #1
rezat4795
LQ Newbie
 
Registered: Dec 2018
Location: Esfahan/Iran
Distribution: Slackware
Posts: 1

Rep: Reputation: Disabled
Need help for creating (converting) a service


Hi. I recently switched to Slackware. I want to use NordVPN. The problem is, they only provide .rpm and .deb packages.
But that's not really important. I just extracted .rpm contents and the program is working just fine now.
The only thing that bothers me is that I have to run its daemon manually. I know that Slackware does not use systemd, so tried to create a service for it, or convert its own systemd service, but I failed.
I would appreciate if anyone can help me.
Here's the systemd service:


[Unit]
Description=NordVPN Daemon
Requires=nordvpnd.socket
After=network-online.target

[Service]
ExecStart=/usr/sbin/nordvpnd
NonBlocking=true
KillMode=process
Restart=on-failure
RestartSec=5

[Install]
WantedBy=default.target

---------------------------------------------

and here's the socket:


[Unit]
Description=NordVPN Daemon Socket
PartOf=nordvpnd.service

[Socket]
ListenStream=/run/nordvpnd.sock
NoDelay=true

[Install]
WantedBy=sockets.target
 
Old 08-09-2019, 02:19 PM   #2
TheRealGrogan
Member
 
Registered: Oct 2010
Location: Ontario, Canada
Distribution: Slackware, Manjaro (for gaming)
Posts: 106

Rep: Reputation: 94
The socket thing is just for on demand starting through the socket, a feature of systemd. If you're able to run the daemon manually, it will be creating everything it needs to run.

You could do something as simple as starting it from rc.local or just pick an appropriate rc.something script from /etc/rc.d and edit it to start and stop /usr/sbin/nordvpnd instead. Add a stanza to rc.M for it and bob's your uncle.

P.S. I'm unfamiliar with the daemon so I don't know what parameters it takes (i.e. stop), so this is just an example:

Call it rc.nordvpn or something, in /etc/rc.d (set it executable)

Code:
nordvpn_start()
{
  /usr/sbin/nordvpnd
}

nordvpn_stop()
{
  killall nordvpnd
}

nordvpn_restart()
{
  nordvpn_stop
  nordvpn_start
}

case $1 in
'start')
  nordvpn_start
  ;;
'stop')
  nordvpn_stop
  ;;
'restart')
  nordvpn_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
Then, in rc.M something like:

Code:
# Start the NordVPN daemon
if [ -x /etc/rc.d/rc.nordvpn ]; then
  /etc/rc.d/rc.nordvpn start
fi

Last edited by TheRealGrogan; 08-09-2019 at 02:54 PM.
 
Old 08-09-2019, 02:49 PM   #3
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 8,923

Rep: Reputation: Disabled
hello rezat4795,

welcome to this forum.

Yes, have a look as the daemon managers in /etc/rc.d.

But you don't have to edit rc.M, instead you can include /etc/rc.d/rc/local code snippet like e.g.
Code:
if [ -x /etc/rc.d/rc.nordvpn ]; then
   /etc/rc.d/rc.nordvpn start
 fi
and make /etc/rc.d/rc.local excutable:
Code:
chmod 755 /etc/rc.d/rc.local
To know more about you can visit https://docs.slackware.com/ if not yet done and more specifically https://docs.slackware.com/howtos:mi...with_slackware


Best regards,

Last edited by Didier Spaier; 08-09-2019 at 04:31 PM.
 
1 members found this post helpful.
Old 08-09-2019, 03:04 PM   #4
TheRealGrogan
Member
 
Registered: Oct 2010
Location: Ontario, Canada
Distribution: Slackware, Manjaro (for gaming)
Posts: 106

Rep: Reputation: 94
Yeah, if you edit rc.M you'd have to remember to fix it up if you update your boot scripts. I never do, they become my boot scripts once I put down a Slackware installation. Mine are all heavily edited.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
systemctl status postgresql-tst.service starts the service if service is stopped MarianForums Linux - Newbie 7 11-03-2018 03:02 PM
help need friends dhcpd service " this service is being refreshed right now golpemortal Linux - Server 2 10-08-2012 03:37 AM
Creating a NURBS model and exporting/converting to IGES mike11 Linux - Software 0 05-12-2009 08:12 PM
Creating/Converting Windows exe to Linux sfcesario Programming 6 08-19-2006 07:27 AM
Converting avi to mpg OR creating an SVCD from an avi MasterC Linux - Software 5 03-28-2003 05:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration