newbie - How to run a script?
Alexander Dalloz
ad+lists at uni-x.org
Wed Dec 29 09:30:32 UTC 2004
Am Mi, den 29.12.2004 schrieb Srinivas G. um 7:30:
> At last I have written the daemon script file perfectly. It was working
> fine. I am able to run the daemon from the RPM spec file also. But at
> the time of system boot, the daemon is loaded two times. If I run the
> script using /etc/init.d/tifmd start then it is loaded once only. In
> the RPM spec file I specified the command like chkconfig --add tifmd.
> Without ant error messages daemon was executed.
chkconfig --list tifmd
lists the service? From what do you see that the deamon is started 2
times, from the process list or from "rc.status" (whatever that does)?
If you see it running 2 times in the process list (what I suspect), then
you will have to search where you certainly accidentally call the
service too. Maybe something left in /etc/rc.local?
> Why it was executed two times at the system boot up level only? Am I
> doing any mistake in the script file? Please see the script for the
> daemon is as follows.
>
> #! /bin/sh
> #
> ### BEGIN INIT INFO
> # Provides: tifmd
> # Required-Start: $syslog $remote_fs
> # Required-Stop: $syslog $remote_fs
> # Default-Start: 2 3 5
> # Default-Stop: 0 1 6
> # Description: This script provides support to starting and stopping the
> daemon timfd for to help the tifm driver
> ### END INIT INFO
/usr/share/doc/initscripts*/sysvinitfiles contains detailed
instructions. What I miss is a line
chkconfig: 235 90 10
See i.e. /etc/init.d/sendmail on how a proper init script head looks
like.
> tifmd_BIN=/usr/sbin/tifmd
>
> # source function library
> if [ -f /etc/rc.d/init.d/functions ]; then
> . /etc/rc.d/init.d/functions
> else
> . /etc/rc.status
What is this rc.status?
> fi
>
> test -x $tifmd_BIN || { echo "TIFMS | $tifm_BIN not installed";
> if [ "$1" = "stop" ]; then exit 0;
> else exit 5; fi; }
For what this "if else" logic? Why do you bypass the stop) case below?
> RETVAL=0
>
> case "$1" in
> start)
> echo -n "TIFMDS | Starting tifmd Daemon... "
> #start the daemon using daemon command
> daemon $tifmd_BIN
> touch /var/lock/subsys/tifmsd
> echo
> exit 0
Why the "exit 0"?
> ;;
> stop)
> echo -n "TIFMDS | Shutting down tifmd Daemon... "
> ## Stop daemon with killproc(8) and if this fails
> killproc $tifmd_BIN
> rm -f /var/lock/subsys/tifmsd
> echo
> ;;
> reload)
> echo -n "TIFMDS | Reloading service tifmd Daemon... "
> killproc $tifmd_BIN -HUP
> RETVAL=$?
> echo
> ;;
> report)
> echo -n "TIFMDS | Checking for service tifmd Daemon... "
> killproc $tifmd_BIN -USR1
> RETVAL=$?
> echo
> ;;
> restart)
> $0 stop
> $0 start
> ;;
> status)
> status tifmd
> ;;
> *)
> echo $"Usage: $0 {start|stop|reload|report|restart|status}"
> RETVAL=1
> esac
> exit $RETVAL
> Srinivas G
Alexander
--
Alexander Dalloz | Enger, Germany | new address - new key: 0xB366A773
legal statement: http://www.uni-x.org/legal.html
Fedora GNU/Linux Core 2 (Tettnang) on Athlon kernel 2.6.9-1.6_FC2smp
Serendipity 10:18:50 up 6 days, 12:02, load average: 0.12, 0.15, 0.09
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20041229/10f114e5/attachment-0001.sig>
More information about the fedora-list
mailing list