What is the proper way to start services on boot?
Been looking around, majority of these answers are around 2004-2008 and even so, they are rather confusing. Do I put a command in rc.M or rc.local ? At the moment I just put a command like this in rc.local "/etc/rc.d/rc.vsftpd &" without "" and that seems to work...but is this correct? Will Slackware properly shutdown the process when shutting down?
|
*deleted* proper answers below ;)
|
As you've probably already figured out, rc.M will attempt to execute rc.local so you can use either.
I also put mine in to rc.local, as that seems to be exactly what it was meant for. For shutdown, if your app does not respond to the sighup/kill signal before shutdown, you can put your 'stop the app' command in to "rc.local_shutdown". (You may have to create rc.local_shutdown and make it executable.) The rc.K script will attempt to execute rc.local_shutdown if it exists & is executable. |
Quote:
Code:
# Very Secure File Transfer Protocol (FTP) server. Code:
chmod +x /etc/rc.d/rc.inetd Code:
/etc/rc.d/rc.inetd start Niki PS: there's no rc.vsftpd. |
I realize your specific situation was answered by kikinovak, but since you were confused, the below is to try an un-muddy the waters (hopefully I don't make it worse).
For anything that isn't already built into Slackware (like kikinovak showed you with vsftpd), the general consensus is to add any additional commands to your rc.local (if you add it to rc.M, it can cause issues with system upgrades or Slackware patches if there's changes made to rc.M). It is generally preferred that any new program installed on the system that needs to start at bootup (commonly called a daemon) should have it's own rc.program_name in /etc/rc.d that supports the start/stop/restart commands (most of these types of programs on SBo will have the needed rc.program_name file included). With these, it's preferred to call them in rc.local after checking to see if they're executable (this makes it follow the Slackware way of only needing to make the file executable to have it run, and if it isn't executable, you won't get an error because of it): Code:
# Start program_name Code:
#!/bin/sh |
Here is a practical example of bassmadrigal's statement. It illustrates that you can display inconsistencies (like trying to start a service already running, or stop a non started service) and also the service' status.
Code:
#!/bin/sh |
Quote:
|
Quote:
|
Slackware's init system is SysV compatible, isn't it?
So, I usually create one universal starter/stopper script in /etc/rc.d/ or /etc/rc.d/init.d (or whereever you like) and setup symlinks from /etc/rc.d/rc[0123456].d/ (or /etc/rc[0123456].d/ which are symlinks to former locations). Such scheme allows Package.t?z to install service control scripts as files, not as patches to system scripts(in doinst.sh). And when package is being removed, service control scripts will be cleanly removed from system. No more edit conflicts, startup sequence control. |
Quote:
But be careful: knowing how same folks react on this forum, maybe you just opened a can of worms or Pandora's box or <your preferred metaphor here> ;) |
I think "A Bob's box of canned-worms" is probably the proper phrase...
|
Quote:
i do remember seeing something ugly about it in the init scripts |
Quote:
/etc/rc.d/init.d/README.functions says: Code:
If you're reading this in /etc/init.d/, Slackware's real init directory is |
Quote:
thx for looking instead of me :) |
All times are GMT -5. The time now is 09:01 AM. |