TFTP Service 1.0.7 (#1877)
* TFTP Service v1.0.7
Fixed linux and windows run as service issues
Fixed linux systemd service self install issues
Modified windows service self install process
* Revert "TFTP Service v1.0.7"
This reverts commit 4418ca7a11.
* TFTP Service v1.0.7
Fixed linux and windows run as service issues
Fixed linux systemd service self install issues
Modified windows service self install process
This commit is contained in:
@@ -1,19 +1,26 @@
|
||||
[Unit]
|
||||
Description={$name}
|
||||
Description={$fullname}
|
||||
After=syslog.target network.target {$database}
|
||||
Requires={$database}
|
||||
|
||||
[Service]
|
||||
User=www-data
|
||||
Group=www-data
|
||||
WorkingDirectory={$scriptfolder}
|
||||
Type=simple
|
||||
PIDFile=/run/{$shortname}.pid
|
||||
WorkingDirectory={$scriptfolder}
|
||||
StandardOutput=null
|
||||
StandardError=syslog
|
||||
ExecStart=/usr/bin/php {$scriptname}
|
||||
ExecStart=/usr/bin/php {$scriptpath}
|
||||
ExecStop=/bin/kill $MAINPID
|
||||
PrivateTmp=true
|
||||
InaccessibleDirectories=/home /root /boot /opt /mnt /media /etc /usr
|
||||
ReadOnlyDirectories=
|
||||
InaccessibleDirectories=/home /root /boot /opt /mnt /media
|
||||
ReadOnlyDirectories=/etc /usr
|
||||
|
||||
;Permissions
|
||||
User=root
|
||||
Group=daemon
|
||||
|
||||
;Limits
|
||||
LimitCORE=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -30,7 +30,8 @@ require_once 'tftpserver.class.php';
|
||||
|
||||
class tftpservice extends TFTPServer
|
||||
{
|
||||
private $_debug=true;
|
||||
private $_headless=true;
|
||||
private $_debug=false;
|
||||
private $_dbtype;
|
||||
private $_dbhost;
|
||||
private $_dbport;
|
||||
@@ -42,6 +43,7 @@ class tftpservice extends TFTPServer
|
||||
function __construct($server_url, $config)
|
||||
{
|
||||
parent::__construct($server_url);
|
||||
if (isset($config['headless'])) $this->_headless=$config['headless'];
|
||||
if (isset($config['debug'])) $this->_debug=$config['debug'];
|
||||
if (isset($config['db_type'])) $this->_dbtype=$config['db_type'];
|
||||
if (isset($config['db_host'])) $this->_dbhost=$config['db_host'];
|
||||
@@ -57,12 +59,14 @@ class tftpservice extends TFTPServer
|
||||
}
|
||||
|
||||
private function log($client, $level, $message) {
|
||||
if($level!='D'||$this->_debug)
|
||||
if(!$this->_headless && ($level!='D' || $this->_debug)) {
|
||||
echo
|
||||
date("H:i:s") . " " .
|
||||
$level . " " .
|
||||
$client . " " .
|
||||
$message . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function get($client, $filepath, $mode)
|
||||
|
||||
Reference in New Issue
Block a user