Debian This forum is for the discussion of Debian Linux.
|
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-30-2010, 03:59 PM
|
#1
|
|
Member
Registered: Jun 2006
Location: Debian Land
Posts: 963
Rep:
|
Fighting with making running a script at startup only but not at shutdown/reboot ...
Hello,
So I found many methods on google, but no one works. It seems that this one is THE Debian way.
Code:
### BEGIN INIT INFO
# Provides: mystartupscript
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start script at boot time and stop at shut down
# Description: Enable service provided by daemon.
### END INIT INFO
######
here my script below
then how to make it work only for the startup only (so,ie at power on)?
Code:
sudo update-rc.d mystartupscript defaults
Many thanks if someone has any ideas how to perform such complicate procedure ... 
|
|
|
|
11-30-2010, 05:04 PM
|
#2
|
|
Senior Member
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,300
Rep: 
|
Quote:
Originally Posted by Xeratul
then how to make it work only for the startup only (so,ie at power on)?
|
Just make it so that your init script only handles the "start" parameter:
Code:
case "$1" in
start)
# Do startup
;;
stop)
# Do nothing
;;
*)
# Print usage or do nothing
;;
esac
|
|
|
|
12-01-2010, 02:21 AM
|
#3
|
|
Member
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Rep:
|
This link may help a bit. http://wiki.debian.org/LSBInitScripts I've got a daemon that launches at boot time and it's called picsdaemond; the file that launches it is called picsdaemondctl. Picsdaemondctl is the file that is used with the update-rc.d command to update the init scripts.
|
|
|
|
12-01-2010, 08:08 AM
|
#4
|
|
Member
Registered: Feb 2007
Location: VA, USA
Distribution: CentOS, Fedora
Posts: 53
Rep:
|
Why do they make this so difficult in Debian based distros? I'm not bashing, just wondering what the reasoning behind it is.
|
|
|
|
12-01-2010, 01:04 PM
|
#5
|
|
Member
Registered: May 2007
Distribution: Ubuntu 10.04
Posts: 58
Rep:
|
For debian based systems you should have a skeleton file /etc/init/skeleton which shows the correct format for the procedure which starts or stops a service.
For the start function check for the existence of the lock file. If the lock file exists return 0, otherwise start the program, touch the lock file (to create it) and return 1
For the stop function check for the existence of the lock file. If the file does not exist return 0, otherwise kill the program, delete the lock file, then return 1
Setup the script to start in every runlevel except runlevel 0. This will activate the program only once to start it, and only stop it on runlevel 0. To shutdown without actually killing the program be sure to remove the lock file, otherwise starting the script at startup will do nothing since the lockfile is what is used to determine if a program needs to be started.
|
|
|
|
12-01-2010, 01:13 PM
|
#6
|
|
Member
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 113
Rep:
|
Perhaps I misunderstand the question...
...but can't you do this using @reboot in cron?
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:29 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|