我放置命令
khmac
到/etc/init.d,然后执行
chkconfig khmac上
打开以使该命令在下次启动时自动启动。
我已经在SLES12,RHEL7,RHEL8
(和所有以前的平台)上执行了此操作,chkconfig
可以在所有这些平台上正常工作(khmac
可以成功自动启动)。
当我在SLES15
上执行此操作时,chkconfig
无法正常工作。很奇怪
并且我检查了Administration Guide
(enter link description here)中的SLES15
,chkconfig
上仍支持SLES15
。
有人可以帮助我吗?
SLES 15:
linux-fatm:/etc/init.d # cat /etc/os-release
NAME="SLES"
VERSION="15"
VERSION_ID="15"
PRETTY_NAME="SUSE Linux Enterprise Server 15"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15"
linux-fatm:/etc/init.d #
linux-fatm:/etc/init.d # pwd
/etc/init.d
linux-fatm:/etc/init.d # ll
total 80
-rwxr-xr-x 1 root root 565 Nov 20 03:28 khmac
-rw-r--r-- 1 root root 12288 Nov 22 21:43 .khmac.swp
-r-x------ 1 root root 17331 Nov 20 01:32 splx
-r-x------ 1 root root 28407 Nov 20 01:32 splxcore
-r-x------ 1 root root 13966 Nov 20 01:32 splxhttpd
-rwxr-xr-x 1 root root 0 Nov 22 21:56 xxx.sh
linux-fatm:/etc/init.d # chkconfig khmac on
linux-fatm:/etc/init.d # chkconfig -l
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
khmac 0:off 1:off 2:off 3:off 4:off 5:off 6:off
splx 0:off 1:off 2:off 3:off 4:off 5:off 6:off
splxcore 0:off 1:off 2:off 3:off 4:off 5:off 6:off
splxhttpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
xxx.sh 0:off 1:off 2:off 3:off 4:off 5:off 6:off
RHEL 8:
[root@localhost opt]# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.0 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.0"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.0 Beta (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.0:beta"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.0
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.0 Beta"
[root@localhost opt]#
[root@localhost opt]# ll /etc/init.d/
total 28
-rw-r--r--. 1 root root 18325 Aug 3 08:33 functions
-rwxr-xr-x. 1 root root 565 Nov 22 21:46 **khmac**
-rw-r--r--. 1 root root 1161 Oct 16 09:34 README
[root@localhost opt]# **chkconfig khmac on**
[root@localhost opt]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
khmac 0:off 1:off 2:on 3:on 4:on 5:on 6:off
SLES 12:
KASSuSe12x64-202:~/khmac # cat /etc/os-release
NAME="SLES"
VERSION="12"
VERSION_ID="12"
PRETTY_NAME="SUSE Linux Enterprise Server 12"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12"
KASSuSe12x64-202:~/khmac # ll /etc/init.d/
total 200
-rwxr--r-- 1 root root 357 Apr 25 2017 after.local
-rwxr-xr-x 1 root root 2964 Sep 27 2014 boot.apparmor
drwxr-xr-x 1 root root 112 Apr 25 2017 boot.d
-rwxr-xr-x 1 root root 2297 Jun 23 2014 boot.kdump
-rwxr--r-- 1 root root 378 Apr 25 2017 boot.local
-rwxr-xr-x 1 root root 1536 Oct 9 2014 boot.udev
-rwxr-xr-- 1 root root 5806 Mar 1 2013 cifs
-rwxr-xr-x 1 root root 3666 Oct 8 2014 dbus
-rwxr--r-- 1 root root 343 Apr 25 2017 halt.local
-rwxr-xr-x 1 root root 1409 Sep 23 2014 inputattach
-rwxr-xr-x 1 root root 13790 Sep 23 2014 ipmi
-rwxr-xr-x 1 root root 568 May 4 2017 khmac
-rw-r--r-- 1 root root 12288 Nov 20 16:29 .khmac.swo
-rw-r--r-- 1 root root 0 May 4 2017 .khmac.swp
-rwxr--r-- 1 root root 10015 Sep 23 2014 nfs
-rwxr--r-- 1 root root 11138 Sep 23 2014 nfsserver
-rwxr-xr-x 1 root root 2030 Sep 23 2014 openct
-rwxr-xr-x 1 root root 2606 Sep 23 2014 pcscd
-rwxr-xr-x 1 root root 8173 Sep 23 2014 postfix
-rwxr--r-- 1 root root 1264 Sep 27 2014 raw
drwxr-xr-x 1 root root 0 Sep 21 2014 rc0.d
drwxr-xr-x 1 root root 0 Sep 21 2014 rc1.d
drwxr-xr-x 1 root root 96 Apr 25 2017 rc2.d
drwxr-xr-x 1 root root 164 Nov 23 11:03 rc3.d
drwxr-xr-x 1 root root 64 Nov 2 17:53 rc4.d
drwxr-xr-x 1 root root 196 Nov 23 11:04 rc5.d
drwxr-xr-x 1 root root 0 Sep 21 2014 rc6.d
drwxr-xr-x 1 root root 0 Sep 21 2014 rcS.d
-rwxr-xr-x 1 root root 2528 Sep 21 2014 rpmconfigcheck
-rwxr-xr-x 1 root root 1437 Sep 21 2014 slpd
-rwxr-xr-x 1 root root 5420 Sep 23 2014 snmpd
-rwxr-xr-x 1 root root 3562 Sep 23 2014 snmptrapd
-r-x------ 1 root root 17331 Nov 2 17:54 splx
-r-x------ 1 root root 28407 Nov 2 17:54 splxcore
-r-x------ 1 root root 13966 Nov 2 17:54 splxhttpd
KASSuSe12x64-202:~/khmac # chkconfig khmac on
KASSuSe12x64-202:~/khmac # chkconfig -l
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
after.local 0:off 1:off 2:off 3:off 4:off 5:off 6:off
cifs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
dbus 0:off 1:off 2:on 3:on 4:off 5:on 6:off
inputattach 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ipmi 0:off 1:off 2:off 3:off 4:off 5:off 6:off
khmac 0:off 1:off 2:off 3:on 4:off 5:on 6:off
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfsserver 0:off 1:off 2:off 3:off 4:off 5:off 6:off
openct 0:off 1:off 2:on 3:on 4:on 5:on 6:off
pcscd 0:off 1:off 2:on 3:on 4:off 5:on 6:off
postfix 0:off 1:off 2:off 3:on 4:off 5:on 6:off
raw 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rpmconfigcheck 0:off 1:off 2:off 3:off 4:off 5:off 6:off
slpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmptrapd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
splx 0:off 1:off 2:off 3:on 4:on 5:on 6:off
splxcore 0:off 1:off 2:off 3:off 4:off 5:off 6:off
splxhttpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
xinetd based services:
chargen: off
chargen-udp: off
cups-lpd: off
daytime: off
daytime-udp: off
discard: off
discard-udp: off
echo: off
echo-udp: off
netstat: off
rsync: off
servers: off
services: off
systat: off
time: off
time-udp: off
vnc: off
vsftpd: off
KASSuSe12x64-202:~/khmac #
RHEL7:
[root@localhost ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[root@localhost ~]# ll /etc/init.d/
total 108
-rw-r--r--. 1 root root 17500 May 3 2017 functions
-rwxr-xr-x. 1 root root 565 Nov 23 10:34 khmac
-rwxr-xr-x. 1 root root 4334 May 3 2017 netconsole
-rwxr-xr-x. 1 root root 7293 May 3 2017 network
-rw-r--r--. 1 root root 1160 Aug 5 2017 README
-r-x------. 1 root root 17331 Sep 5 10:34 splx
-r-x------. 1 root root 28407 Sep 5 10:34 splxcore
-r-x------. 1 root root 13966 Sep 5 10:34 splxhttpd
[root@localhost ~]#
[root@localhost ~]# chkconfig khmac on
[root@localhost ~]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
khmac 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off