pfSense Gold Subscription

Author Topic: Starting daemons without writing a package  (Read 29608 times)

0 Members and 1 Guest are viewing this topic.

Offline molar

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Starting daemons without writing a package
« on: December 09, 2006, 06:08:49 pm »
Hello

I've searched google, newsgroups, the mailing lists and these fine forums but have found no mention of any way to start freebsd daemons at bootup without writing a package?

Is there a way to hack a service to startup without writing a full blown package and front end for webConfigurator?

I.e. the equivalent of servicename_enable="YES" in rc.conf.

Thanks. :)

Offline hoba

  • Hero Member
  • *****
  • Posts: 5837
  • Karma: +8/-0
  • What was the problem to this solution again?
    • View Profile
    • pfSense
Re: Starting daemons without writing a package
« Reply #1 on: December 09, 2006, 06:19:29 pm »

Offline rsw686

  • Sr. Member
  • ****
  • Posts: 520
  • Karma: +0/-0
    • View Profile
    • The Reptile File
Re: Starting daemons without writing a package
« Reply #2 on: December 09, 2006, 06:58:24 pm »
You could just make an rc file and stick it in /usr/local/etc/rc.d/ follow the format for an existing one.

Offline molar

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Starting daemons without writing a package
« Reply #3 on: December 10, 2006, 05:40:43 am »
Thanks to you both. I will let you know how I get on.

Offline Justinw

  • Full Member
  • ***
  • Posts: 168
  • Karma: +1/-0
    • View Profile
Re: Starting daemons without writing a package
« Reply #4 on: December 11, 2006, 01:45:46 pm »
If you installed additional services using the pkg_add command, it usually generates its own rc.d file in /usr/local/etc/rc.d Just vi the file and change the enable:NO to YES and rename it to a shell script (.sh extension).  That is how I have been doing it anyways, I'm guessing someone is about to tell me that its a bad idea for one reason or another though...

Offline sullrich

  • Hero Member
  • *****
  • Posts: 5110
  • Karma: +7/-2348
    • View Profile
    • pfSense
Re: Starting daemons without writing a package
« Reply #5 on: December 11, 2006, 02:41:43 pm »
If you installed additional services using the pkg_add command, it usually generates its own rc.d file in /usr/local/etc/rc.d Just vi the file and change the enable:NO to YES and rename it to a shell script (.sh extension).  That is how I have been doing it anyways, I'm guessing someone is about to tell me that its a bad idea for one reason or another though...

Bad idea.   JUST KIDDING.   This is absolutely fine what you are doing.  This is the correct way to start "extra" programs in pfSense.  Either this method or use <shellcmd> which you can place within <system> in config.xml.

Example:

<system>
  <shellcmd>tcpdump -i xl0 &amp;
...
...

Notice &amp;.  You need to encode special characters since this is in a XML space.

The advantage to config.xml mod is that your change gets backed up and restored meaning you do not need to recreate the rc.d file if you want to reinstall.

Offline molar

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Starting daemons without writing a package
« Reply #6 on: December 13, 2006, 06:10:26 am »
I've done it now thanks ;D

I changed the enable:NO to YES in the shell script so that it always starts up by default.

Thanks for the XML explanation as well.