Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting web socket at boot #4787

Closed
milehighkaraoke opened this issue Mar 26, 2021 · 13 comments
Closed

Starting web socket at boot #4787

milehighkaraoke opened this issue Mar 26, 2021 · 13 comments
Labels

Comments

@milehighkaraoke
Copy link

Is there a way to automatically start the websocket at boot. Nginx is in crontab and starts automatic at boot. I tried following it with another crontab for the websocket without success. Any help with this would be greatly appreciated as manually starting services everytime I reboot is annoying.

@antuk21
Copy link

antuk21 commented Mar 26, 2021

@milehighkaraoke
Copy link
Author

I tried this without success. The only way it starts for me is to manually run the command.

Screenshot_20210325-195131_Samsung Internet

@antuk21
Copy link

antuk21 commented Mar 26, 2021

witch verson off ubuntu do you use did you open port 2053 in your gate way that will be why need to allow it try that get back to me

@milehighkaraoke
Copy link
Author

2053 is open I am using Ubuntu 20.04

@antuk21
Copy link

antuk21 commented Mar 26, 2021

@reboot /usr/local/nginx/sbin/nginx && nohup php /var/www/html/AVideo/plugin/Li$
@reboot nohup php /var/www/html/AVideo/plugin/YPTSocket/server.php &
0 2 * * * php /var/www/html/AVideo/plugin/cache/crontab.php

dose your eu crontab config look like this at end off blue code

@antuk21
Copy link

antuk21 commented Mar 26, 2021

been few updates today so do a git pull maybe

cd /var/www/html/AVideo/ && sudo git pull

cd /var/www/html/YouPHPTube/ && sudo git pull

@milehighkaraoke
Copy link
Author

Root crontab is identical.Gitpull is complete.....Nginx starts on boot but the websocket has to still be manually started.

@akhilleusuggo
Copy link
Contributor

akhilleusuggo commented Mar 27, 2021

I'll update the wiki that @DanielnetoDotCom wrote . The script is missing the most important thing at boot/reboot ( Sleep time ).
The socket can not start at boot before giving Apache few seconds to load modules , so the script fails .

Replace your crontab with this ;

@reboot sleep 60;nohup php /var/www/html/AVideo/plugin/YPTSocket/server.php &

The script will start 60s after boot/reboot ( is enough time and recommended to avoid issues )

Wiki updated ; https://github.com/WWBN/AVideo/wiki/Socket-Plugin

@milehighkaraoke
Copy link
Author

Perfect 🥰

@milehighkaraoke
Copy link
Author

I am getting the same results. Waited 5 minutes and socket is still disconnected. Updated crontab to 120 seconds did a reboot and still will not connect with a crontab command

20210327_143454
20210327_144257

@milehighkaraoke
Copy link
Author

I think k it might be a permissions issue. When I log off of my Ubuntu user account , i just noticed that the socket disconnects

@akhilleusuggo
Copy link
Contributor

akhilleusuggo commented Mar 29, 2021

@milehighkaraoke it's not . Look at what you wrote . Must be a space between php and /var/ww.....

copy and past this :

@reboot sleep 60; nohup php /var/www/MHKTube/plugin/YPTSocket/server.php &

@milehighkaraoke
Copy link
Author

Thank you that was the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants