Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
9cf9152c
Commit
9cf9152c
authored
Apr 24, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: varrun_path assimilation; resistance is futile
parent
537ba265
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
34 deletions
+27
-34
rrd.inc
src/etc/inc/rrd.inc
+4
-7
system.inc
src/etc/inc/system.inc
+23
-27
No files found.
src/etc/inc/rrd.inc
View file @
9cf9152c
...
@@ -287,7 +287,7 @@ function enable_rrd_graphing() {
...
@@ -287,7 +287,7 @@ function enable_rrd_graphing() {
$rrdupdatesh
.=
"
\n
"
;
$rrdupdatesh
.=
"
\n
"
;
$rrdupdatesh
.=
"export TERM=dumb
\n
"
;
$rrdupdatesh
.=
"export TERM=dumb
\n
"
;
$rrdupdatesh
.=
"
\n
"
;
$rrdupdatesh
.=
"
\n
"
;
$rrdupdatesh
.=
'echo $$ >
'
.
$g
[
'varrun_path'
]
.
'
/updaterrd.sh.pid'
;
$rrdupdatesh
.=
'echo $$ >
/var/run
/updaterrd.sh.pid'
;
$rrdupdatesh
.=
"
\n
"
;
$rrdupdatesh
.=
"
\n
"
;
$rrdupdatesh
.=
"counter=1
\n
"
;
$rrdupdatesh
.=
"counter=1
\n
"
;
$rrdupdatesh
.=
"while [
\"\$
counter
\"
-ne 0 ]
\n
"
;
$rrdupdatesh
.=
"while [
\"\$
counter
\"
-ne 0 ]
\n
"
;
...
@@ -920,10 +920,7 @@ function create_gateway_quality_rrd($rrd_file) {
...
@@ -920,10 +920,7 @@ function create_gateway_quality_rrd($rrd_file) {
unset
(
$rrdtool
,
$rrdinterval
,
$valid
,
$rrd_file
);
unset
(
$rrdtool
,
$rrdinterval
,
$valid
,
$rrd_file
);
}
}
function
kill_traffic_collector
()
{
function
kill_traffic_collector
()
global
$g
;
{
killbypid
(
'/var/run/updaterrd.sh.pid'
);
killbypid
(
"
{
$g
[
'varrun_path'
]
}
/updaterrd.sh.pid"
);
}
}
?>
src/etc/inc/system.inc
View file @
9cf9152c
...
@@ -302,7 +302,7 @@ function system_hosts_generate()
...
@@ -302,7 +302,7 @@ function system_hosts_generate()
* Do not remove this because dhcpleases monitors with kqueue
* Do not remove this because dhcpleases monitors with kqueue
* it needs to be * killed before writing to hosts files.
* it needs to be * killed before writing to hosts files.
*/
*/
killbypid
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
);
killbypid
(
'/var/run/dhcpleases.pid'
);
$fd
=
fopen
(
'/etc/hosts'
,
'w'
);
$fd
=
fopen
(
'/etc/hosts'
,
'w'
);
if
(
!
$fd
)
{
if
(
!
$fd
)
{
...
@@ -334,8 +334,8 @@ function system_dhcpleases_configure()
...
@@ -334,8 +334,8 @@ function system_dhcpleases_configure()
if
(
!
file_exists
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
))
{
if
(
!
file_exists
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
))
{
@
touch
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
);
@
touch
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
);
}
}
if
(
isvalidpid
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
))
{
if
(
isvalidpid
(
'/var/run/dhcpleases.pid'
))
{
killbypid
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
,
'HUP'
);
killbypid
(
'/var/run/dhcpleases.pid'
,
'HUP'
);
}
else
{
}
else
{
/* To ensure we do not start multiple instances of dhcpleases, perform some clean-up first. */
/* To ensure we do not start multiple instances of dhcpleases, perform some clean-up first. */
killbyname
(
'dhcpleases'
);
killbyname
(
'dhcpleases'
);
...
@@ -356,7 +356,7 @@ function system_dhcpleases_configure()
...
@@ -356,7 +356,7 @@ function system_dhcpleases_configure()
);
);
}
}
}
else
{
}
else
{
killbypid
(
"
{
$g
[
'varrun_path'
]
}
/dhcpleases.pid"
);
killbypid
(
'/var/run/dhcpleases.pid'
);
}
}
}
}
...
@@ -552,14 +552,13 @@ function system_staticroutes_configure($interface = "", $update_dns = false) {
...
@@ -552,14 +552,13 @@ function system_staticroutes_configure($interface = "", $update_dns = false) {
file_put_contents
(
"
{
$g
[
'varetc_path'
]
}
/filterdns-route.hosts"
,
$hostnames
);
file_put_contents
(
"
{
$g
[
'varetc_path'
]
}
/filterdns-route.hosts"
,
$hostnames
);
unset
(
$hostnames
);
unset
(
$hostnames
);
if
(
isvalidpid
(
"
{
$g
[
'varrun_path'
]
}
/filterdns-route.pid"
))
{
if
(
isvalidpid
(
'/var/run/filterdns-route.pid'
))
{
killbypid
(
"
{
$g
[
'varrun_path'
]
}
/filterdns-route.pid"
,
'HUP'
);
killbypid
(
'/var/run/filterdns-route.pid'
,
'HUP'
);
}
else
{
}
else
{
mwexec
(
"/usr/local/sbin/filterdns -p
{
$g
[
'varrun_path'
]
}
/filterdns-route.pid -i
{
$interval
}
-c
{
$g
[
'varetc_path'
]
}
/filterdns-route.hosts -d 1"
);
mwexec
(
"/usr/local/sbin/filterdns -p
/var/run
/filterdns-route.pid -i
{
$interval
}
-c
{
$g
[
'varetc_path'
]
}
/filterdns-route.hosts -d 1"
);
}
}
}
else
{
}
else
{
killbypid
(
"
{
$g
[
'varrun_path'
]
}
/filterdns-route.pid"
);
killbypid
(
'/var/run/filterdns-route.pid'
);
@
unlink
(
"
{
$g
[
'varrun_path'
]
}
/filterdns-route.pid"
);
}
}
}
}
unset
(
$filterdns_list
);
unset
(
$filterdns_list
);
...
@@ -775,14 +774,15 @@ EOD;
...
@@ -775,14 +774,15 @@ EOD;
$syslogd_extra
=
"-f
{
$g
[
'varetc_path'
]
}
/syslog.conf
{
$sourceip
}
"
;
$syslogd_extra
=
"-f
{
$g
[
'varetc_path'
]
}
/syslog.conf
{
$sourceip
}
"
;
}
}
if
(
isvalidpid
(
"
{
$g
[
'varrun_path'
]
}
/syslog.pid"
))
{
if
(
isvalidpid
(
'/var/run/syslog.pid'
))
{
killbypid
(
"
{
$g
[
'varrun_path'
]
}
/syslog.pid"
,
'HUP'
);
killbypid
(
'/var/run/syslog.pid'
,
'HUP'
);
}
else
{
}
else
{
$retval
=
mwexec_bg
(
"/usr/local/sbin/syslogd -s -c -c -l
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/log -P
{
$g
[
'varrun_path'
]
}
/syslog.pid
{
$syslogd_extra
}
"
);
$retval
=
mwexec_bg
(
"/usr/local/sbin/syslogd -s -c -c -l
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/log -P
/var/run
/syslog.pid
{
$syslogd_extra
}
"
);
}
}
if
(
file_exists
(
"/var/run/booting"
))
if
(
file_exists
(
"/var/run/booting"
))
{
echo
gettext
(
"done."
)
.
"
\n
"
;
echo
gettext
(
"done."
)
.
"
\n
"
;
}
return
$retval
;
return
$retval
;
}
}
...
@@ -850,12 +850,10 @@ function system_webgui_start()
...
@@ -850,12 +850,10 @@ function system_webgui_start()
"cert.pem"
,
"ca.pem"
);
"cert.pem"
,
"ca.pem"
);
/* kill any running lighttpd */
/* kill any running lighttpd */
killbypid
(
"
{
$g
[
'varrun_path'
]
}
/lighty-webConfigurator.pid"
);
killbypid
(
'/var/run/lighty-webConfigurator.pid'
);
sleep
(
1
);
sleep
(
1
);
@
unlink
(
"
{
$g
[
'varrun_path'
]
}
/lighty-webConfigurator.pid"
);
/* regenerate the php.ini files in case the setup has changed */
/* regenerate the php.ini files in case the setup has changed */
mwexec
(
'/usr/local/etc/rc.php_ini_setup'
);
mwexec
(
'/usr/local/etc/rc.php_ini_setup'
);
...
@@ -1104,7 +1102,7 @@ EOD;
...
@@ -1104,7 +1102,7 @@ EOD;
#server.error-handler-404 = "/error-handler.php"
#server.error-handler-404 = "/error-handler.php"
## to help the rc.scripts
## to help the rc.scripts
server.pid-file = "
{$g['varrun_path']}
/{$pid_file}"
server.pid-file = "
/var/run
/{$pid_file}"
## virtual directory listings
## virtual directory listings
server.dir-listing = "disable"
server.dir-listing = "disable"
...
@@ -1568,8 +1566,8 @@ function system_ntp_configure($start_ntpd = true)
...
@@ -1568,8 +1566,8 @@ function system_ntp_configure($start_ntpd = true)
}
}
/* open configuration for wrting or bail */
/* open configuration for wrting or bail */
if
(
!@
file_put_contents
(
"
{
$g
[
'varetc_path'
]
}
/ntpd.conf"
,
$ntpcfg
))
{
if
(
!@
file_put_contents
(
'/var/etc/ntpd.conf'
,
$ntpcfg
))
{
log_error
(
"Could not open
{
$g
[
'varetc_path'
]
}
/ntpd.conf for writing"
);
log_error
(
"Could not open
/var/etc
/ntpd.conf for writing"
);
return
;
return
;
}
}
...
@@ -1578,21 +1576,19 @@ function system_ntp_configure($start_ntpd = true)
...
@@ -1578,21 +1576,19 @@ function system_ntp_configure($start_ntpd = true)
return
;
return
;
/* if ntpd is running, kill it */
/* if ntpd is running, kill it */
while
(
isvalidpid
(
"
{
$g
[
'varrun_path'
]
}
/ntpd.pid"
))
{
while
(
isvalidpid
(
'/var/run/ntpd.pid'
))
{
killbypid
(
"
{
$g
[
'varrun_path'
]
}
/ntpd.pid"
);
killbypid
(
'/var/run/ntpd.pid'
);
usleep
(
200
*
1000
);
}
}
@
unlink
(
"
{
$g
[
'varrun_path'
]
}
/ntpd.pid"
);
/* if /var/empty does not exist, create it */
/* if /var/empty does not exist, create it */
if
(
!
is_dir
(
"/var/empty"
))
@
mkdir
(
'/var/empty'
,
0775
,
true
);
mkdir
(
"/var/empty"
,
0775
,
true
);
/* start opentpd, set time now and use
/var/etc/ntpd.conf
*/
/* start opentpd, set time now and use
new config
*/
mwexec
(
"/usr/local/sbin/ntpd -g -c
{
$g
[
'varetc_path'
]
}
/ntpd.conf -p
{
$g
[
'varrun_path'
]
}
/ntpd.pid"
,
false
,
true
);
mwexec
(
'/usr/local/sbin/ntpd -g -c /var/etc/ntpd.conf -p /var/run/ntpd.pid'
,
false
,
true
);
// Note that we are starting up
// Note that we are starting up
log_error
(
"NTPD is starting up."
);
log_error
(
"NTPD is starting up."
);
return
;
}
}
function
system_halt
(
$sync
=
false
)
function
system_halt
(
$sync
=
false
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment