123solar.service

Talks about solar stuff
jeanmarc
Posts: 1963
Joined: Thu Aug 29, 2013 7:16 am

Re: 123solar.service

Post by jeanmarc » Wed Jun 24, 2015 4:30 pm

I believe debian don't use systemd yet.. No worry

jatz76
Posts: 24
Joined: Tue Feb 24, 2015 3:50 am

Re: 123solar.service

Post by jatz76 » Thu Jun 25, 2015 12:45 am

Cool. Thanks so much for your input, it is greatly appreciated.
Jac

Chris
Posts: 3
Joined: Wed Oct 28, 2015 8:21 am

Re: 123solar.service

Post by Chris » Wed Oct 28, 2015 9:02 am

Hi Jean-Marc,

I believe there is a small error in 123solar.service which causes the service not to wait until both the prerequisite services have started.

The line that references php-fpm.service I think should be php5-fpm.service

This was causing me no end of problems on my RPi running Raspbian Jessie, as boot123s.php would fail to launch until I made this change.

A separate problem I discovered with boot123s.php (v1.6.7.3) is that if you have IPv6 enabled in your nginx conf file, you will always get the "Direct access not permitted" error. This is because the code only checks for the IPv4 local address (127.0.0.1) and not for the IPv6 local address (::1). If the line was changed to something like this...

Code: Select all

if ($_SERVER['SERVER_ADDR'] != '127.0.0.1' && $_SERVER['SERVER_ADDR'] != '::1') {
    die('Direct access not permitted');
}
...then this would work for both IPv4 and IPv6 local addresses.

Kind Regards,
Chris
http://www.lowefamily.com.au

jeanmarc
Posts: 1963
Joined: Thu Aug 29, 2013 7:16 am

Re: 123solar.service

Post by jeanmarc » Wed Oct 28, 2015 9:36 am

Hi Chris,
On Arch it is php-fpm.service, the 123solar.service shall be modified according to your distro & web server configuration. I should emphasize on that.

Thanks for the ipv6 tips. I don't know much about it, i've changed the file.

Chris
Posts: 3
Joined: Wed Oct 28, 2015 8:21 am

Re: 123solar.service

Post by Chris » Wed Oct 28, 2015 10:09 am

Hi Jean-Marc,

I did wonder whether php-fpm.service was specific to the distro. Obviously it must be for different for Raspbian (Debian)!

I haven't overly tested that IPv6 line of code, but it does seem to work.

BTW, thanks for a great product! :)
Chris
http://www.lowefamily.com.au

YLG80
Posts: 8
Joined: Sun Oct 04, 2015 2:16 pm

Re: 123solar.service

Post by YLG80 » Wed Feb 10, 2016 7:14 pm

Hello,
Due to many problems with my PogoPlug Mobile V4 (new usb stick always corrupted after a few days), I've moved my logger into a Raspberry Pi 2 1Gb with Raspbian Jessie. (Apache-PhP)
Except problems with a dam... default repository with error 404 when apt-getting php5 and libs, everything went smoothly.
However, I've spent many hours trying to autostart 123solar.service to no avail.
Not sure, but it appears that there is a timing problem between the script execution and the server startup.

So I've decided to execute the php startup script right from within the apache2 start-stop script when I was sure of the server startup.
That apache2 script is located in /etc/init.d
Just add the 123solar.service autostart command around line 137 in the apache_wait_start() directive :
apache_wait_start() {
local STATUS=$1
local i=0

if [ $STATUS != 0 ] ; then
return $STATUS
fi
while : ; do
PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)
if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then
return $STATUS
fi

if [ $i = "20" ] ; then
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX instance did not start within 20 seconds. Please read the log files to discover problems"
return 2
fi

[ "$VERBOSE" != no ] && log_progress_msg "."
sleep 1
i=$(($i+1))
/usr/bin/curl http://localhost/scripts/boot123s.php &
done
}
Modify the http://localhost/scripts/boot123s.php URL according to your configuration.
For example :

Code: Select all

/usr/bin/curl http://localhost/123solar/scripts/boot123s.php &
If you are using a specific ip port to get access to the server, don't forget to specify that port after localhost.
For example :

Code: Select all

/usr/bin/curl http://localhost:81/123solar/scripts/boot123s.php &
It worked immediately upon rebooting the RPi.

Also it's not necessary to add the extension=calendar.so and extension=shmop.so into the php.ini.
These extensions are loaded by default so that adding these lines will produce an unnecessary error while starting up PhP. (visible syslog log file)
Not sure if that applies also to the Raspbian Wheezy distribution.

Thanks also to jatz76 for his post on 123solar directory permissions an ownership. ;)
http://www.123solar.org/phpBB/viewtopic.php?t=206#p1669
It helped me to resolve an issue with the events.txt file access denied.

Yves

jeanmarc
Posts: 1963
Joined: Thu Aug 29, 2013 7:16 am

Re: 123solar.service

Post by jeanmarc » Wed Feb 10, 2016 8:03 pm

Hi,
Thanks for your tips but i'am usure they are good :roll: .
Check carefully the help page: How to start 123solar on boot ? I doubt you run on systemd...
Also, i might have wrong but i never saw calendar and shmop exentensions loaded by default in php.ini.

Walter62
Posts: 32
Joined: Thu Aug 29, 2013 11:40 am
Location: Italia
Contact:

Re: 123solar.service

Post by Walter62 » Wed Feb 10, 2016 8:18 pm

Hi.
with Rpy the 123solar.service must be equal to:

Code: Select all

[Unit]
Description=123Solar
Requires=network.target
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/sleep 10
ExecStart=/usr/bin/curl http://localhost/123solar/scripts/boot123s.php

[Install]
WantedBy=default.target

YLG80
Posts: 8
Joined: Sun Oct 04, 2015 2:16 pm

Re: 123solar.service

Post by YLG80 » Wed Feb 10, 2016 9:05 pm

I had this problem with the extensions (apache error.log):

Code: Select all

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/calendar.so' - /usr/lib/php5/20131226/calendar.so: cannot open shared object file: No such file or directory in Unknown on line 0
Despite of that warning, calendar was shown loaded with the command

Code: Select all

php -m 
[PHP Modules]
...
calendar
session
shmop
...
When I comment out extension=calendar.so and extension=shmop.so in the php.ini, they are still loaded and shown by php -m. No error anymore.

About systemd it seems to me that it is being used:

Code: Select all

pi@raspberrypi:~ $ cat /proc/1/comm
systemd
pi@raspberrypi:~ $
I've tested what walter62 suggest in his post. No success :cry: .
Last edited by YLG80 on Fri Feb 12, 2016 11:51 am, edited 2 times in total.

Walter62
Posts: 32
Joined: Thu Aug 29, 2013 11:40 am
Location: Italia
Contact:

Re: 123solar.service

Post by Walter62 » Wed Feb 10, 2016 9:30 pm

If you want try to install this image, is in italian language, but I think is not a problem

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests