LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   service: command not found (https://www.linuxquestions.org/questions/slackware-14/service-command-not-found-4175650153/)

ziggyzagged 03-14-2019 04:15 AM

service: command not found
 
I tried going to /sbin/service and there's no such file/directory.

How can I get the service command?

ponce 03-14-2019 04:36 AM

there's no such command in Slackware, here bash scripts in /etc/rc.d/ are usually used to start/stop services.

read about it in the section "Startup" here.

Quote:

Originally Posted by ziggyzagged (Post 5973710)
How can I get the service command?

you can't because it relies on a different init system specific of the distributions that ship that command.

ttk 03-14-2019 11:18 AM

Quote:

Originally Posted by ziggyzagged (Post 5973710)
I tried going to /sbin/service and there's no such file/directory.

How can I get the service command?

If you explain the task you are trying to accomplish with the "service" command, we might be able to explain how to do it in Slackware (which uses the traditional init system).

kjhambrick 03-14-2019 11:27 AM

ziggyzagged --

What ponce said ...

and what ttk said ...

Slackware has a VERY NICE and CLEAN system for starting daemons ( services ).

Service is a RedHat thing and it's been deprecated in RHEL7 ... they want you to use systemd version of the service commands now ...

Just another $0.02 ...

EDIT: Just noticed there is no obvious pointer to the /etc/rc.d/ Directory in ponce's link.

The Slackware equivalent of RHEL services will be found in the /etc/rc.d directory as a set of executable shell scripts.

For example:
Code:

  RHEL:      # service smb start
  Slackware: # /etc/rc.d/rc.samba start        # make sure that the permissions are 755 first !

If you have an Idea which service you want to start, the filenames in /etc/rc.d/ are pretty clear ( example: rc.samba )

Do be sure to set permissions to 755 for any daemon ( service ) you want to start automatically at boot ( after any configuration )

Check the Docs on ponce's link for more info. There are 'a zillion' docs over there !

HTH.

-- kjh

upnort 03-14-2019 01:35 PM

If you want a service command, here is something I created about 15 years ago. Throw the script into /usr/local/sbin.

Code:

#!/bin/bash
# /usr/local/sbin/service

# A script to start/stop/restart system scripts without typing the full path.

RCD_PATH="/etc/rc.d"

SERVICE="$1"
ACTION="$2"

if [ -z "$SERVICE" ] || [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
  echo "Correct usage: $0 script-name [action]"
  exit 0
fi
SERVICE="`echo $SERVICE | sed 's/^rc.//'`"
if [ ! -f "$RCD_PATH/rc.$SERVICE" ]; then
  echo "$RCD_PATH/rc.$SERVICE does not exist."
  exit 0
else
  bash $RCD_PATH/rc.$SERVICE $ACTION
fi

Massage or murder the script as you see fit. :)

ziggyzagged 03-15-2019 12:29 AM

I want to perform this action:
Code:

service auditd reload

ponce 03-15-2019 01:03 AM

Quote:

Originally Posted by ziggyzagged (Post 5974027)
I want to perform this action:
Code:

service auditd reload

Slackware does not ship the audit package, but it's available on SlackBuilds.org: if you install it from there

https://slackbuilds.org/howto/
https://slackbuilds.org/repository/14.2/system/audit/

then you will have an /etc/rc.d/rc.auditd script with which you could eventually do
Code:

/etc/rc.d/rc.auditd reload
just be sure to read the README and README.SLACKWARE files.


All times are GMT -5. The time now is 09:29 AM.