nazihahz
 
I want to ask regarding OpenPLC Runtime. I have done edit on /etc/systemdd/system/OpenPLC_v3/ start_openplc.sh to make the runtime always login and start again even after i reboot pi like below:
 
[Unit]
Description=OpenPLC Runtime Service
After=network.target
 
[Service]
ExecStart=/usr/bin/python3 /home/pi/OpenPLC_v3/ start_openplc.sh
WorkingDirectory=/home/pi/OpenPLC_v3
Restart=always
User=pi
Environment=PYTHONBUFFERED=1
 
[Install]
WantedBy=multi-user.target


But , i have faced this problem where even after i edit like that , i am still need to login and start the plc on the openplc runtime after i reboot my pi. So what can i do or edit to make the system always start even after i reboot the pi without need to login and click start?
Reply 0 0
fg71
Check if service is enabled
-> systemctl status openplc
 
Loaded: loaded (/lib/systemd/system/openplc.service; disabled; preset: enabled)
 
The bold text above is the status of openplc systemd service is disabled
 
Set the service to enabled
-> systemctl enable openplc
 
Loaded: loaded (/lib/systemd/system/openplc.service; enabled; preset: enabled)
 
The bold text above is the status of openplc systemd service is enabled.
 
I do not think you need to edit any /etc/systemd/..... to make it start every time you reboot.
 
I'm not sure the GPIO will work if you do not login. The new kernel approach to access the GPIO, the user need to be member of group gpio.
The same approach if you use sudo raspi-config to configure the interface options to enable I2C. The current user become member of the group i2c
I do know there are other ways to access the GPIO so I couldn't be 100% sure this is any concern to you or your setup.
Reply 0 0
thiagoralves
OpenPLC has its own systemd service. You should first remove the one you created to avoid conflicts. To auto start the PLC, login, go to settings and check that option.
Reply 0 0
nazihahz
OpenPLC has its own systemd service. You should first remove the one you created to avoid conflicts. To auto start the PLC, login, go to settings and check that option.
thank you so much for helping me after i go to setting and select the auto option now it just work very well.
Reply 0 0
nazihahz
Check if service is enabled
-> systemctl status openplc
 
Loaded: loaded (/lib/systemd/system/openplc.service; disabled; preset: enabled)
 
The bold text above is the status of openplc systemd service is disabled
 
Set the service to enabled
-> systemctl enable openplc
 
Loaded: loaded (/lib/systemd/system/openplc.service; enabled; preset: enabled)
 
The bold text above is the status of openplc systemd service is enabled.
 
I do not think you need to edit any /etc/systemd/..... to make it start every time you reboot.
 
I'm not sure the GPIO will work if you do not login. The new kernel approach to access the GPIO, the user need to be member of group gpio.
The same approach if you use sudo raspi-config to configure the interface options to enable I2C. The current user become member of the group i2c
I do know there are other ways to access the GPIO so I couldn't be 100% sure this is any concern to you or your setup.
thank you so much for helping me...
Reply 0 0
nazihahz
why should always login to openplc runtime after a few minutes i dont use it, can i make it always login? @thiagoralves
Reply 0 0
thiagoralves
That’s a security measure. It automatically logs users off after 5 minutes of inactivity
Reply 0 0
nazihahz
That’s a security measure. It automatically logs users off after 5 minutes of inactivity
so that mean i cannot make it login for 24 hours?
Reply 0 0
thiagoralves
No, unless you dive into the webserver code and modify it
Reply 0 0
nazihahz
Alright.... thank you for helping me 🙂
Reply 0 0
Reply