- Added version detection for Ubuntu 14.10
- Fixed a problem with restart of services due to the fact that Ubuntu has upstart and systemd installed, but only upstart is working without errors.
| | |
| | | $mainver = array_filter($mainver); |
| | | $mainver = current($mainver).'.'.next($mainver); |
| | | switch ($mainver){ |
| | | case "14.10": |
| | | $relname = "(Utopic Unicorn)"; |
| | | break; |
| | | case "14.04": |
| | | $relname = "(Trusty Tahr)"; |
| | | break; |
| | |
| | | |
| | | public function getinitcommand($servicename, $action, $init_script_directory = ''){ |
| | | global $conf; |
| | | // systemd |
| | | if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){ |
| | | return 'systemctl '.$action.' '.$servicename.'.service'; |
| | | } |
| | | // upstart |
| | | if(is_executable('/sbin/initctl')){ |
| | | exec('/sbin/initctl version 2>/dev/null | /bin/grep -q upstart', $retval['output'], $retval['retval']); |
| | | if(intval($retval['retval']) == 0) return 'service '.$servicename.' '.$action; |
| | | } |
| | | // systemd |
| | | if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){ |
| | | return 'systemctl '.$action.' '.$servicename.'.service'; |
| | | } |
| | | // sysvinit |
| | | if($init_script_directory == '') $init_script_directory = $conf['init_scripts']; |
| | | if(substr($init_script_directory, -1) === '/') $init_script_directory = substr($init_script_directory, 0, -1); |
| | |
| | | $mainver = array_filter($mainver); |
| | | $mainver = current($mainver).'.'.next($mainver); |
| | | switch ($mainver){ |
| | | case "14.10": |
| | | $relname = "(Utopic Unicorn)"; |
| | | break; |
| | | case "14.04": |
| | | $relname = "(Trusty Tahr)"; |
| | | break; |
| | |
| | | |
| | | function getinitcommand($servicename, $action, $init_script_directory = ''){ |
| | | global $conf; |
| | | // systemd |
| | | if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){ |
| | | return 'systemctl '.$action.' '.$servicename.'.service'; |
| | | } |
| | | // upstart |
| | | if(is_executable('/sbin/initctl')){ |
| | | exec('/sbin/initctl version 2>/dev/null | /bin/grep -q upstart', $retval['output'], $retval['retval']); |
| | | if(intval($retval['retval']) == 0) return 'service '.$servicename.' '.$action; |
| | | } |
| | | // systemd |
| | | if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){ |
| | | return 'systemctl '.$action.' '.$servicename.'.service'; |
| | | } |
| | | // sysvinit |
| | | if($init_script_directory == '') $init_script_directory = $conf['init_scripts']; |
| | | if(substr($init_script_directory, -1) === '/') $init_script_directory = substr($init_script_directory, 0, -1); |