Note that there are some explanatory texts on larger screens.

plurals
  1. POService doesn't support chkconfig
    primarykey
    data
    text
    <p>Good day,programmers. I have a problem. Please help. I am creating a service, which must load automatically when Linux is being loaded. So,I copied the script into the directory /etc/rc.d/init.d or /etc/init.d/. But when I am preforming the command </p> <pre><code>chkconfig --add listOfProcesses </code></pre> <p>an error occurs:</p> <pre><code>service listOfProcesses doesn't support chkconfig </code></pre> <p>Here is the content of the script. I have found the first version in the Google and have used it as a pattern.</p> <pre><code>#!/bin/bash # listOfProcesses Start the process which will show the list of processes # chkconfig: 345 110 02 # description: This process shows current time and the list of processes # processname: listOfProcesses ### BEGIN INIT INFO # Provides: # Required-Start: # Required-Stop: # Default-Start: 3 4 5 # Default-Stop: 0 1 2 6 # Short-Description: shows current time and the list of processes # Description: This process shows current time and the list of processes ### END INIT INFO # Source function library. KIND="listOfProcesses" start() { echo -n $"Starting $KIND services: " daemon /home/myscript echo } stop() { echo -n $"Shutting down $KIND services: " killproc /home/myscript echo } restart() { echo -n $"Restarting $KIND services: " killproc /home/myscript daemon /home/myscript echo } case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $? exit 0; </code></pre> <p>The second version was made from the cron script. I found the cron script,copied it, and changed it, so I used it as the pattern.</p> <pre><code>#!/bin/sh # # crond Start/Stop the cron clock daemon. # # chkconfig: 2345 90 60 # description: cron is a standard UNIX program that runs user-specified \ # programs at periodic scheduled times. vixie cron adds a \ # number of features to the basic UNIX cron, including better \ # security and more powerful configuration options. ### BEGIN INIT INFO # Provides: crond crontab # Required-Start: $local_fs $syslog # Required-Stop: $local_fs $syslog # Default-Start: 2345 # Default-Stop: 90 # Short-Description: run cron daemon # Description: cron is a standard UNIX program that runs user-specified # programs at periodic scheduled times. vixie cron adds a # number of features to the basic UNIX cron, including better # security and more powerful configuration options. ### END INIT INFO rights=whoami; root=root; [ -f "$rights"=="$root" ] || { echo "this programme requires root rights"; exit 1; } # Source function library. . /etc/rc.d/init.d/functions start() { echo -n $"Starting $KIND services: "; daemon showListOfProcesses; } stop() { echo -n $"Shutting down $KIND services: "; killproc showListOfProcesses; } restart() { stop start } reload() { restart; } force_reload() { # new configuration takes effect after restart restart } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; force-reload) force_reload ;; *) echo $"Usage: $0 {start|stop|restart|reload|force-reload}" exit 2 esac exit $? # Show the list of processes function showListOfProcesses { top &gt; /dev/tty2; } </code></pre> <p>But the situation hadn't changed. What is the problem? What is wrong in the script?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload