LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 10-29-2003, 01:18 AM   #1
dimangi
LQ Newbie
 
Registered: Oct 2003
Distribution: redhat 9.0
Posts: 1

Rep: Reputation: 0
init script won't run at log-off


My script @ /etc/init.d doesn't run when I log off. It works fine at logon.

I have made a script, which is supposed to upload my current ip-address and online-status to a static www-server. This way I'd have a www-server running any time my comp is on, but the link inside would disappear when I log off.

There are 2 scripts: "httpstart.sh" and "httpstop.sh", and they are supposed to be run when the runlevel changes to 5. Both scripts work manually: "/sbin service wwwserv {stop|start}" and from the graphical services tool.

I have put a script "wwwserv" to /etc/init.d/, and ran "chkconfig --add wwwserv" + "chkconfig --level 5 wwwserv on". I have also checked /etc/rcN.d/ directories, and they have the right links there (K05wwwserv @ /rc6.d/).

Here is the "wwwserv" script:
-----------------------------------------------------------
#!/bin/sh
# chkconfig: - 99 5
# description: running a simple script at boottime
# processname: wwwserv
# /etc/sysconfig/httpstart.sh
# /etc/sysconfig/httpstop.sh
##################################################

case "$1" in
start)
echo -n "Starting wwwserv: "
/etc/sysconfig/httpstart.sh
echo
;;
stop)
echo -n "Stopping wwwserv: "
/etc/sysconfig/httpstop.sh
echo
;;
restart)
$0 stop
$0 start
;;
*)
echo $"Usage: wwwserv {start|stop|restart}"
exit 1
esac

exit 0
-------------------------------------------------------------

There is nothing done when i turn off the computer, and I didn't fnd any errors from /var/log/messages (starting the service seems to work fine).

I'm running rh9.0 with adsl.

Any suggestions, or more info needed??
 
Old 10-29-2003, 02:19 AM   #2
kris.kj.jacobs
Member
 
Registered: Jun 2001
Location: Belgium
Distribution: Mandrake
Posts: 57

Rep: Reputation: 15
Have seen this on Redhat Linux 6 and 9.

The standard init scripts create an empty file in some directory at startup (/var/run, /var/lock, /var/subsys, ...).

At shutdown the system checks for this file before it starts the script at shutdown.

Check /etc/rc.sysinit to see how this works.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc/X11/xinit/.Xmodmap; run level 4 won't init script Potatopopper Slackware 5 11-27-2005 07:37 PM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM
Where is 'init' run from? (slackware 9.0) itsjustme Slackware 12 05-18-2003 03:14 PM
could use some help with my init.d script.... BrianK Linux - General 3 10-31-2002 07:21 PM
setting script to run when system enter init 3 fowlerlfc Linux - Newbie 2 10-29-2002 03:02 PM


All times are GMT -5. The time now is 07:09 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration