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

CLI commands to start and stop services

Scheduled Pinned Locked Moved General pfSense Questions
6 Posts 4 Posters 40.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.
  • O
    oletuv
    last edited by May 27, 2016, 9:16 PM

    What are the CLI commands to start and stop a service, e.g. Avahi, in pfSense. I tried "service avahi restart" in the Shell but got an "avahi does not exists …" error.

    1 Reply Last reply Reply Quote 0
    • H
      heper
      last edited by May 27, 2016, 10:14 PM

      
       WAN (wan)       -> em0        -> v4/DHCP4: 74/21
       LAN (lan)       -> em1        -> v4: 10.0.0.1/24
       IPV6_TUNNEL (opt1) -> gif0       -> v6: 2001:ac7::2/128
       OVPN_SHIL (opt2) -> ovpnc1     -> v4: 192.168.222.2/32
       WIFI (opt3)     -> dc0        -> v4: 192.168.101.254/24
      
       0) Logout (SSH only)                  9) pfTop
       1) Assign Interfaces                 10) Filter Logs
       2) Set interface(s) IP address       11) Restart webConfigurator
       3) Reset webConfigurator password    12) pfSense Developer Shell
       4) Reset to factory defaults         13) Update from console
       5) Reboot system                     14) Disable Secure Shell (sshd)
       6) Halt system                       15) Restore recent configuration
       7) Ping host                         16) Restart PHP-FPM
       8) Shell
      
      Enter an option: 12
      
      Starting the pfSense developer shell....
      
      Welcome to the pfSense developer shell
      
      Type "help" to show common usage scenarios.
      
      Available playback commands:
           changepassword checkopenvpn_status disablecarp disabledhcpd disablereferercheck enableallowallw                                                        
      an enablecarp enablesshd externalconfiglocator generateguicert gitsync installpkg listpkg removepkgc                                                        
      onfig removeshaper restartdhcpd restartipsec svc tmp2 uninstallpkg 
      
      pfSense shell: playback svc
      
      Playback of file svc started.
      
      Usage: playback svc <action><service name="">[service-specific options]
      
      Examples:
      playback svc stop dhcpd
      playback svc restart openvpn client 2
      playback svc stop captiveportal zone1
      
      pfSense shell:</service></action> 
      

      https://doc.pfsense.org/index.php/Using_the_PHP_pfSense_Shell

      1 Reply Last reply Reply Quote 0
      • O
        oletuv
        last edited by May 28, 2016, 8:08 AM

        @oletuv:

        What are the CLI commands to start and stop a service, e.g. Avahi, in pfSense. I tried "service avahi restart" in the Shell but got an "avahi does not exists …" error.

        service avahi-daemon.sh start
        service avahi-daemon.sh stop
        service avahi-daemon.sh restart

        1 Reply Last reply Reply Quote 0
        • L
          luckman212 LAYER 8
          last edited by Mar 7, 2017, 6:26 AM

          If you want to schedule it via Cron, you can use something like

          15    9    *    *    *    root    /usr/local/sbin/pfSsh.php playback svc restart avahi
          
          1 Reply Last reply Reply Quote 1
          • S
            stuck
            last edited by Oct 12, 2017, 3:27 AM

            @luckman212:

            If you want to schedule it via Cron, you can use something like

            15    9    *    *    *    root    /usr/local/sbin/pfSsh.php playback svc restart avahi
            

            I know this thread is quite old, but I need to run a command like this via Putty's plink command line.  But I keep getting

            putty.exe>plink -ssh -pw somepasswd root@192.168.0.1 "/usr/local/sbin/pfSsh.php playback svc restart openvpn client 1"
            The process cannot access the file because it is being used by another process.
            

            Any help is appreciated

            1 Reply Last reply Reply Quote 0
            • L
              luckman212 LAYER 8
              last edited by Oct 12, 2017, 3:40 AM

              your command looks (mostly) ok – that error seems to be from your Windows machine, not the remote pfSense system. It looks like you have "putty.exe>" in front of the plink.exe on your commandline. Why? that is not correct...
              https://the.earth.li/~sgtatham/putty/0.70/htmldoc/Chapter7.html#plink-usage-interactive

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                This community forum collects and processes your personal information.
                consent.not_received