RE: newbie - How to run a script?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: fedora-list-bounces@xxxxxxxxxx [mailto:fedora-list-
> bounces@xxxxxxxxxx] On Behalf Of Alexander Dalloz
> Sent: Monday, December 27, 2004 5:12 PM
> To: For users of Fedora Core releases
> Subject: Re: newbie - How to run a script?
> 
> Am Mo, den 27.12.2004 schrieb Srinivas G. um 12:35:
> 
> > I have written a script under Fedora Core 3 with 2.6.9-1.667 kernel
> > version. Previously I used to run the script in the RPM spec file
using
> > insserv -d /etc/init.d/tifmd where tifmd is my script name. Now I am
> > unable to find the insserv command under Fedora Core 3.
> >
> > What is the equivalent command for insserv command? How to run a
script?
> 
> You certainly want to use chkconfig. See FC3 service RPMs spec files
for
> inspiration, i.e.
> 
> http://cvs.fedora.redhat.com/viewcvs/rpms/vsftpd/FC-
> 3/vsftpd.spec?rev=1.18&view=markup
> 
> > Srinivas G
> 
> Alexander

Dear Alexander, 

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.

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


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
fi

test -x $tifmd_BIN || { echo "TIFMS | $tifm_BIN not installed"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

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
	;;
    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

Please give me an idea or any links are welcome.

Thanks in advance and regards,
Srinivas G


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux