Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    What is the comand to start a service?

    Scheduled Pinned Locked Moved General pfSense Questions
    8 Posts 3 Posters 5.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bilbus
      last edited by

      I am looking to write something that will automaticly run a comand every X mins.

      For example ntop keeps stopping and i would like a way to make it restart if it crashes. I have done something similor in linux with a simple script (where the script ran as the service, and if the program crashed, the script would loop and would just restart the program and repeat)

      Does anyone know of any documentation for doing something like this on bsd, i have some linux experince but i have not used bsd at all.

      what is a service called on bsd?

      So i am looking for the comand to restart a service and how to create a new service. Thanks!

      1 Reply Last reply Reply Quote 0
      • R
        rocky
        last edited by

        You may use crontab. If you need a interval which is less than 1minute (for example, regular check something in 20 seconds) you may use the http://cr.yp.to/daemontools.html. It's very easy!

        1 Reply Last reply Reply Quote 0
        • B
          bilbus
          last edited by

          Thanks!

          1 Reply Last reply Reply Quote 0
          • B
            bilbus
            last edited by

            What do i need to type to manualy restart a service from ssh?

            i looked for ntop in /etc/rc.d but it was not there. Is it in another location, or am i missing it?
            Thanks

            1 Reply Last reply Reply Quote 0
            • R
              rocky
              last edited by

              To restart squid from the webGUI you may use
                https://<firewall_ip>/status_services.php?mode=restartservice&service=squid

              (Tab : / webGUI / Status / Services )

              You should read the php code in
                /usr/local/www/status_services.php
                /etc/inc/service-utils.inc

              I don't use ntop so I don't know extactly how to restart it.</firewall_ip>

              1 Reply Last reply Reply Quote 0
              • B
                bilbus
                last edited by

                is there a comand to stop services and start them. I do not want to use php, if i am going to use cron.
                Thanks

                1 Reply Last reply Reply Quote 0
                • R
                  rocky
                  last edited by

                  PHP script is a great idea of pfsense/monowall. Why dont' you use PHP for you jobs?

                  Create `foobar.php' like

                  
                    // ...
                    restart_my_services();
                  ?>
                  
                  

                  and run (as cron job)

                  
                  php /path/to/foobar.php
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • 0
                    0tt0
                    last edited by

                    @bilbus:

                    is there a comand to stop services and start them. I do not want to use php, if i am going to use cron.
                    Thanks

                    I think you could use 'kill'.
                    http://www.freebsd.org/doc/en/books/handbook/basics-daemons.html

                    To start simply use either service name or complete path to application, depending on if it's in the "path" in the system.
                    You should see that logging on to the shell and typing 'set' I think.

                    Cheers,

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.