Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 18th February 2019
hanzer's Avatar
hanzer hanzer is offline
Real Name: Adam Jensen
just passing through
Join Date: Oct 2013
Location: EST USA
Posts: 314
Default How to execute a command at system startup

My FreeBSD system needs to execute a couple simple commands sometime during or shortly after the boot process. After a bit of searching, it seems many people have this need and there doesn't seem to be a canonical solution. There is much written about managing services (daemons) but learning the details of rc.d scripting in order to execute a command (# camcontrol apm 0:0:0 -l 250) seems like [s]a dirty[/s] an absurd hack. The rc man page says:
The rc.local script contains
commands which are pertinent only to a specific site. Typically, the
/usr/local/etc/rc.d/ mechanism is used instead of rc.local these days but
if you want to use rc.local, it is still supported. In this case, it
should source /etc/rc.conf and contain additional custom startup code for
your system. The best way to handle rc.local, however, is to separate it
out into rc.d/ style scripts and place them under /usr/local/etc/rc.d/.
This is the only information I could find about /etc/rc.local (was this vague, sentimental man page blurb written by a child?). If anyone here is familiar with rc.local syntax and its use within the FreeBSD rc system, if you could post a simple, best practices example of a working script, that would be very helpful!
Reply With Quote

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AWK passing the argument to system command Oko Programming 6 6th July 2011 08:03 PM
Scripted sysinstall fails with "Command 'system' failed" PeterSteele FreeBSD Installation and Upgrading 0 13th November 2008 11:31 PM
execute commands from xinitrc rex FreeBSD General 3 22nd October 2008 10:24 PM
Execute a command during login rex FreeBSD General 4 12th September 2008 08:09 PM
ruby execute commands remotely Dr_Death_UAE Programming 0 18th August 2008 11:23 AM

All times are GMT. The time now is 01:37 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick