ClearFoundation Tracker - ClearOS
View Issue Details
0001579ClearOSapp-base - Base Systempublic2014-02-20 07:582014-02-20 08:42
bchambers 
bchambers 
normalminorhave not tried
closedwon't fix 
6.5.0 
6.5.0 Updates 
0001579: Sometimes impossible to start services from Webconfig
Services aren't perfect and sometimes exit uncleanly. For example:

# /etc/rc.d/init.d/ipsec status
IPsec stopped
but...
has subsystem lock (/var/lock/subsys/ipsec)!

In this case, it is impossible to start the service via Webconfig. Simply stopping the service using init scripts cleans up the lock files and the service starts.

Webconfig's Daemon should stop a service before starting if it is in the stopped state as a pro-active resolution to this type of issue. No harm in doing so...and it may prevent user frustration in this type of scenario (eg. they will never see/know of the orphaned lock file) except in the log file.

 
No tags attached.
related to 0001239closed user2 For good measure, the daemon widget should stop a process before starting 
Issue History
2014-02-20 07:58bchambersNew Issue
2014-02-20 07:58bchambersStatusnew => assigned
2014-02-20 07:58bchambersAssigned To => bchambers
2014-02-20 08:04user2Note Added: 0001146
2014-02-20 08:05user2Relationship addedrelated to 0001239
2014-02-20 08:06user2Note Added: 0001147
2014-02-20 08:26bchambersNote Added: 0001148
2014-02-20 08:32bchambersNote Added: 0001149
2014-02-20 08:33bchambersStatusassigned => closed
2014-02-20 08:33bchambersResolutionopen => won't fix
2014-02-20 08:42user2Note Added: 0001150

Notes
(0001146)
user2   
2014-02-20 08:04   
I think this was already done... checking.
(0001147)
user2   
2014-02-20 08:06   
The start/stop daemon widget behaves this way - 0001239 The Daemon API should stay as-is, but perhaps the "Services" app needs to be changed?
(0001148)
bchambers   
2014-02-20 08:26   
Running app-base-1.5.23-1

No mention of stopping service first in the 'set_running_state' function:

public function set_running_state($state)
    {
        clearos_profile(__METHOD__, __LINE__);

        Validation_Exception::is_valid($this->validate_state($state));

        if (! $this->is_installed())
            throw new Engine_Exception(lang('base_not_installed'));

        $is_running = $this->get_running_state();

        if ($is_running && $state) {
            // issued start on already running daemon
            return;
        } else if (!$is_running && !$state) {
            // issued stop on already stopped daemon
            return;
        }

        $args = ($state) ? 'start' : 'stop';
        $options['stdin'] = "use_popen";

        $shell = new Shell();
        $shell->execute(self::COMMAND_SERVICE, "$this->initscript $args", TRUE, $options);
    }
(0001149)
bchambers   
2014-02-20 08:32   
Ah...in the controller...I see.

Hmmm...wonder why it did not work.

I was starting Ipsec from the Dynamic VPN page.

<lightbulb>This was trying to start the vpnwatch daemon, not IPsec</lightbulb>

Sorry!

Hmm...wonder why vpnwatchd wasn't starting ;-)
(0001150)
user2   
2014-02-20 08:42   
The change in 0001239 is done in the widget/controller (controllers/daemon.php), so apps using that standard stop/start button in webconfig should already be doing a "stop" before a start. Perhaps that's broken?

The set_running_state() method should behave the same way as the system IMHO. I have no objection with adding a flag to that method though.