Fedora startup script help
Muhammad Imran
imranqau-PkbjNfxxIARBDgjK7y7TUQ at public.gmane.org
Fri Mar 10 04:10:03 UTC 2006
Hi everyone,
I am trying to run a perl/BASH script as a daemon upon entering run-level 3.
Here is what I did:
I copied a script from /etc/init.d and modified it: put sym links in
/etc/rc.d/rc3.d & rc0.d
When system enters run level 3, it displays message "Starting my daemon".
However it doesn't detach from terminal and stays there. I am trying to run
it as daemon (detached from launching terminal) using daemon function in
shell startup script. but apparently its not working.
Can anybody suggest a way to run a perl script as daemon upon startup on
Fedora?
Any help/advice is highly appreciated.
Here is what startup script looks like:
#############
#!/bin/bash
SERVER=/usr/sbin/myfirewalld
prog="Intrusion detection system"
[ -f $SERVER ] || exit 0
start() {
echo -n $"Starting $prog: "
daemon $SERVER
RETVAL=$?
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/myfirewalld
echo
}
stop() {
echo -n $"Stoping $prog: "
kill -9 $SERVER 2>/dev/null
rm -f /var/lock/subsys/myfirewalld
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status myfirewalld
;;
restart|reload)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit 0
################ end of startup script ######################
And here is a sample server/daemon BASH script:
########################
#!/bin/sh
#loop forever
while :
do
# now sleep for 5 minutes
sleep 30
# after wakeup send message to all users
wall <<EOF
I am running.....
EOF
done
###########################
Obviously, I will replace this script with something more useful :) once i
figure it out how to run it detached from terminal;
Regards,
Imran.
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list